Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Convert SQL Query to DAX Measure

Hi All,

I have the following query in SQL

Select da.AreaKey,AreaNumber from dimarea da
inner join factarea fa on fa.Areakey = da.AreaKey
where m2m = 0

 I wan't to create a DAX measure for that SQL query in Power BI. How to write this SQL query in DAX Measure

1 ACCEPTED SOLUTION
v-mengzhu-msft
Community Support
Community Support

Hi @Anonymous ,

 

Due to the lack of many relevant data as a basis, I can only write a simple one for your reference.Like this:

 

measure= var _table= summarize('dimarea da',[da.Areakey],[AreaNumber])
return calculate(expression, filter([m2m]="0",[da.Areakey] in selectedvalue([fa.Areakey])

 

Related dax function used above link are as the following show :

 

SUMMARIZE function (DAX) - DAX | Microsoft Learn

CALCULATE function (DAX) - DAX | Microsoft Learn

FILTER function (DAX) - DAX | Microsoft Learn

SELECTEDVALUE function - DAX | Microsoft Learn

 

Hope these can help you.

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

2 REPLIES 2
v-mengzhu-msft
Community Support
Community Support

Hi @Anonymous ,

 

Due to the lack of many relevant data as a basis, I can only write a simple one for your reference.Like this:

 

measure= var _table= summarize('dimarea da',[da.Areakey],[AreaNumber])
return calculate(expression, filter([m2m]="0",[da.Areakey] in selectedvalue([fa.Areakey])

 

Related dax function used above link are as the following show :

 

SUMMARIZE function (DAX) - DAX | Microsoft Learn

CALCULATE function (DAX) - DAX | Microsoft Learn

FILTER function (DAX) - DAX | Microsoft Learn

SELECTEDVALUE function - DAX | Microsoft Learn

 

Hope these can help you.

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

PowerUserR
Solution Supplier
Solution Supplier

Hi,
I think this external guide can help you: https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.