Loading...

How to generate DAX Function using Chat GPT for Power BI

How to generate DAX Function using Chat GPT for Power BI

In this article I will discuss how to work on DAX code using ChatGPT for Power BI, People they are already working on Power Bi will be familiar with DAX functions which are very useful when we work with Power BI for data visualization. This article is very interesting here we will discuss “How to write DAX functions by using ChatGPT for Power BI”.

Usually, it takes a lot of time for mastering in Power BI DAX functions, but by using ChatGPT we will get the DAX functions very quickly and can easily use in our Power BI projects. 

Here we have a Sales Data Set, I used the Sample data set which are already available in Power BI for learning purpose. You can easily access this data set from the below path.

1. Implicit Method

For this Open Power BI Desktop, go to the path.

Help > Examples > Samples dataset > then click Load Sample data.

How to generate DAX Function using Chat GPT

Then select the financials table and click Load button as shown in the figure.

How to generate DAX Function using Chat GPT

In the right-side Data Pane, you can see the columns in the financials table.

How to generate DAX Function using Chat GPT

Here the next step is create a visual which is showing the total sales by country.

For this from the visualization tab, we are selecting a Table visual, then drag and drop the Country and Sales Field from the financials table as shown in the figure. 

How to generate DAX Function using Chat GPT

Now you can see the total sales value against each country in a tabular view, this method is implicit method, here we no need to take extra steps, we need only drag and drop the columns which are already available in the dataset.

2. Write Measure Using ChatGPT (Explicit Measure)

Next, we can write a measure to find the Sum of total sales by country by using ChatGPT, for this you make a ChatGPT query as shown below.

For this we write a ChatGPT query as shown below.

"I have uploaded one table in Power BI

Table name is financials which has column names Country, Sales

Create a DAX function which calculates Sales by country."



Here "financials" is the dataset and Country, Sales are the table columns which are the required columns to generate the sales by country report.

Copy and paste this query into the ChatGPT as shown below,

How to generate DAX Function using Chat GPT

Then press enter button, you can see ChatGPT generate DAX function which calculates total Sales by country. Copy the function.

In the Power BI create a measure by clicking the New Measure button under Home > Calculations menu.

Then paste the function, which was copied from ChatGPT as shown below,

How to generate DAX Function using Chat GPT

Now a measure will be created with name Sales_by_Country, drag and drop this measure to the Table visual as shown in the figure,

How to generate DAX Function using Chat GPT

Here you can see one column Sales_by_Country is created, which is a calculated column by using DAX function and is called as explicit measure and you can use this measure in another table or anywhere the project.

Conclusion

From the above example you can see , by using DAX function generated by ChatGPT and normal explicit method , in both methods the result is showing as same. This is one of the simplest examples, you can write different DAX functions by using ChatGPT for different purposes, only one thing you need care is you write the correct ChatGPT query which can understand by ChatGPT easily, then only ChatGPT can write correct DAX functions which matches for your project.

If this article is useful, please try to share to your friends and social media. In the next article we will discuss how to write DAX functions by using Microsoft Copilot.

Usefull Tags

How to Use Chat GPT for Power BI: It's Easy!
How do you write a DAX query?
Is it hard to learn DAX?
What is DAX language?
What is a DAX function?
How ChatGPT helps to write DAX measures in Power BI
Power BI Mastery with Chat GPT
Chat GPT for DAX Calculations
Writing DAX with ChatGPT
Power BI + ChatGPT
Writing DAX with ChatGPT
How to generate dax function using chat gpt python
How to generate dax function using chat gpt in excel
chatgpt
power bi chat gpt integration
how to use chatgpt in power bi
chatgpt power bi plugin
chat gpt power bi

Published on:

Learn more
D365 Snippets
D365 Snippets

Share post:

Related posts

Comparing calculation options in Power BI, including Visual Calculations

There are tons of options in Power BI to add your custom logic. Varying from SQL expressions at data ingest all the way up to Visual Calculati...

17 hours ago

SCD Type 2 in Microsoft Fabric and Power BI

In the previous article, I explained SCD (Slowly Changing Dimension) and its different types. In this article, I’ll show you how to impl...

1 day ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy