Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all
I have a calculated column which gives the correct result; however, it's making my model very heavy in size, therefore I'd like to optimize it with Dax.
I am using 2 alternatives in dax to eliminate the calculated column.
First option is nested IFs and the second one is Switch & True. What I have noticed is that IF is very slow compared to Switch.
As seen below, the Year 1 matches row by row but the totals for the IF measure, Switch measure and Calculated Column.
For year 2:
For the IF the results row by row are ok, but the total is incorrect. The Switch measure is incorrect in both rows and total.
How can I have both the IF and Switch return the correct values per row and the total too for year 2? The correct result is the calculated column.
I attach a sample PBIX and xls to make it easier.
Thanks!!
As an update, I changed in the relationship direction to "both" instead of "single" and now the results row by row seem ok.
The only thing I would need help is in getting the total value correct.
Thanks.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |