Skip to content
Advertisement

How to convert SQL statement to Power BI DAX?

I have no idea how to recreate the following code from SQL to DAX in Power BI:

select Z, sum(X) as sumcount, avg(Y) as avgcount
from example_table
group by Z

Or perhaps there is a way to operate on SQL commands in Power BI with imported and filtered tables?

I want to do the SQL query on the already sliced data in Power BI.

Thank you in advance 🙂

Advertisement

Answer

You can achieve this by following dax calculated table

Table = summarize(example_table[z], "sumcount", sum(example_table[x]), " Avgcount", Average(example_table[Y]))
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement