Home > OS >  How to convert SQL statement to Power BI DAX?
How to convert SQL statement to Power BI DAX?

Time:11-06

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 :)

CodePudding user response:

You can achieve this by following dax calculated table

Table = summarize(example_table[z], "sumcount", sum(example_table[x]), " Avgcount", Average(example_table[Y]))

CodePudding user response:

You can execute sql queries from direct query feature, where connect data host and schema.

enter image description here

  • Related