Forum Discussion
parry2k
8 years agoSuper User
count by measure
hi there, I have a calculated measure to calculate the share % of each category, based on category share there is ranking, if % > 20 then A if % > 10 then B else C I added the measure for ra...
parry2k
8 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_Muhammad
8 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 )
)
)