Forum Discussion
count by measure
I was doing the same but here are few changes which I made and it is not working:
- No sum on amount in table to calculate %
- % is calculated based on allselected
- small change in rank formula to get 3 values
- made changes to "measure" to allselected instead of allselected(Table1[Category])
now if you select multiple values in slicer, you don't get correct result. Take a look, I made the changes in attached.
Thanks,
P
-
- Vvelarde8 years agoCommunity Champion
Try with this modification:
RANK = VAR Share = [% share] RETURN IF ( Share > 0.10, "A", IF ( Share > 0.05, "B", "C" ) )Victor
- parry2k8 years agoSuper User
VvelardeThanks for getting back. Although I sorted it out but wanted to check how you experts will do. I will test your solution. Cheers!!
- Zubair_Muhammad8 years agoCommunity Champion
Sorry I couldn't get time to look into this after my intial post.
Victor is right ..Great observation....this modification should fix the matter for Count of Categories
"The measure "RANK" inside FILTER (or any other ITERATOR function) will modify itself according to the Table passed as argument inside the ITERATOR. Thats why it should be put in a variable first"Attached revised file as well
To get the distinctcount of categories
DistinctCount_Categories = VAR myrank = SELECTEDVALUE ( RANKs[RANK] ) RETURN CALCULATE ( DISTINCTCOUNT ( Table1[Category] ), CALCULATETABLE ( VALUES ( Table1[Category] ), FILTER ( Table1, [Rank] = myrank ) ) )