简体   繁体   中英

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

You can achieve this by following dax calculated table

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

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM