Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi!
I have a very general question but I think many developers are searching for an best possible approach writing good dax formulas. Few days ago I saw a nice written dax code (which I cannot remember:-( ) But anyway, it was building a measure, that first created some selected filters into some variables, then it started to build up a virtual small table and added the filter sto it.
Next, it added one column through the ADDCOLUMNS functions which also included some local variables and additional logic.
The again a new variable filter was created, and put into the virtual table. And so on... Finally we get a spot on data table where we could the measure value we wanted. I though this was an elegant way to create measures and perhaps it is easier to debug the dax code as well. And perhaps this approach can even get better performace.
So my question is: Is this a good way to write dax code or do you have even better suggestions solving dax calculation problems? Examples would be grate.
Regards Geir
Solved! Go to Solution.
Hi @geiratatea ,
Please review the following links, hope they can help you.
HOW TO IMPROVE POWER BI PERFORMANCE - PART II
Use Performance Analyzer to examine report element performance (can see and record logs that measure how each of your report elements performs when users interact with them, and which aspects of their performance are most (or least) resource intensive.)
Best Regards
Hi:
There are serveral places to help format code correctly.
https://www.daxformatter.com/ for one.
You can also use DAX Studio, Dax.do. TabularEditor(3)
You'll notice they have both Long and Short form methodes for writing the code. Any of these choices should help you see the correct(accepted) way of writing DAX. I hope this answers your question. Thanks..
Hi and thanks for responding. I was thinking more in direction of writing dax logic in a best way. Formatting will of course make it easier to read and will gain readability. my question is about breaking down a business problem into smaller pieces of code that can make it easier to solve. Good technique will guilde us to the target I guess
Hi @geiratatea ,
Please review the following links, hope they can help you.
HOW TO IMPROVE POWER BI PERFORMANCE - PART II
Use Performance Analyzer to examine report element performance (can see and record logs that measure how each of your report elements performs when users interact with them, and which aspects of their performance are most (or least) resource intensive.)
Best Regards
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
31 | |
15 | |
11 | |
10 | |
8 |
User | Count |
---|---|
62 | |
20 | |
11 | |
11 | |
11 |