Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I have this DAX expression and it works fine.
Solved! Go to Solution.
I can't tell you the best way to write your particular DAX expression. However, since you are interested in optimizing your DAX, sqlbi.com always publish articles about the best way to optimize DAX.
Here is a link to their most recent articles on DAX optimization:
https://www.sqlbi.com/articles/?author=&tag_id=411
Also, they have DAX studio which allows you to test how long your DAX takes to run. You can change things up to see if your DAX changes affect performance.
Hope that helps.
@Anonymous
I'm looking at your 2nd expression. It looks like you are filtering the transaction table, but then you don't really specify how to filter the transaction table; your parameters are for a different table.
Typically, if I'm trying to filter a specific table based on parameters in another table (related, inactive/active, fact side/dimension side), I use RELATED, RELATEDTABLE, or USERELATIONSHIP in my filter statement.
Here is an examle from my sqlbi slides...
SUMX (
FILTER (
ProductCategory,
COUNTROWS ( RELATEDTABLE ( Product ) ) > 10
),
SUMX ( RELATEDTABLE ( Sales ), Sales[SalesAmount] )
)
I have written this expression and seems to be working fine... Not sure if this can be optimised in any way or written using best practises?
Great question.
If you are formatting your DAX properly, which you are obviously doing based on your latest post, you are following best practices with respect to writting/formatting DAX.
Keeping up with best practices and your workload can be difficult. The staff at SQLBI do a lot of work to educate people regarding best practices; there is also great content on this board.
If you haven't already, check out sqlbi.com. Marco is in some vids with the doods that create Guy In A Cube YouTube content.
Well done!
Thanks @Anonymous 🙂
But i was not referring to the formatting itself, rather more the logic to ensure it is working efficiently
I can't tell you the best way to write your particular DAX expression. However, since you are interested in optimizing your DAX, sqlbi.com always publish articles about the best way to optimize DAX.
Here is a link to their most recent articles on DAX optimization:
https://www.sqlbi.com/articles/?author=&tag_id=411
Also, they have DAX studio which allows you to test how long your DAX takes to run. You can change things up to see if your DAX changes affect performance.
Hope that helps.
can you just confirm the structure of your model - is the transaction date connected to the date dimension via a date key?
Yes the Transactions table is connected to the DateKey, so relationships are established already.
Thanks @danno
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |