Forum Discussion
Count Multiple items by the item
- 8 years ago
Hi HungryPowerBIer,
You can also use the alternative approach by creating a new table on top of your base table.
Go to the Data tab on the left hand side, then go to modelling tab and under the calculations, you would see the new table.
Select and Paste the below DAX Syntax,
MyTable= SUMMARIZE(BaseTable,
BaseTable[Fruit],
"TotalRows",COUNTROWS(BaseTable))And then create a calculated column in your newly created MyTable using the below syntax to get the ranking of the products.
RankingColumn= COUNTROWS(FILTER(MyTable,EARLIER([TotalRows])>[TotalRows]))+1
Thanks,
Bhavesh
Hey,
first - welcome to this community.
I'm not sure if I understand your requirement correctly, but why not just create a measure that counts the items like in this screenshot:
Hope this is what you are looking for
Regards
Tom
A simple Count is giving problems with my second measure, which is counting all items, and not separating them out. This is hampering visuals I am working on, which require the ranking to be accurate. The ranking is returning all ones, as seen below, because it is working off the total count.
- Ashish_Mathur8 years agoSuper User
Hi HungryPowerBIer,
You are writing rank as a column. Wite it as a measure
=RANKX(ALL(Query[Fruit]),[Just a count])
Does this work?