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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I am not new to DAX and this is a very simple measure, but for some reason it does not work this time.
I want to calculate to the share of total for every category.
The measure:
For my own sanity I tried it for a different measure, because I know this should work.
Measure:
As you can see, the measure is basically the same and it works.
Sometimes DAX drives me crazy with it's inconsistencies, can someone please explain why it does not work in the first example?
Thanks
Solved! Go to Solution.
I would guess that your customer rating column is sorted by a different column. You need to add that sort by column into the ALL function as well as the rating itself. The sort by column is used in the query behind the table visual, and so that column is in the evaluation context as well as the rating column.
@Tymok Probably has something to do with your base measure. Would have to see both of them to determine if something in there is the cause. If you avoid CALCULATE you generally don't get these kinds of inconsistencies.
Customer rating Share of Total (%) =
VAR __Rating = [Customer rating count]
VAR __AllRating =
SUMX(
ADDCOLUMNS(
SUMMARIZE( ALL( 'Customer Rating' ), [Rating] ),
"__Measure", [Customer rating count]
),
[__Measure]
)
VAR __Result = DIVIDE( __Rating, __AllRating )
RETURN
__Result
Bonus, you can troubleshoot it.
I would guess that your customer rating column is sorted by a different column. You need to add that sort by column into the ALL function as well as the rating itself. The sort by column is used in the query behind the table visual, and so that column is in the evaluation context as well as the rating column.
Thank you, this fixed it.
Never knew sort by different column could have these consequences.
User | Count |
---|---|
15 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
29 | |
17 | |
11 | |
7 | |
5 |