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
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.
Hi HungryPowerBIer,
You are writing rank as a column. Wite it as a measure
=RANKX(ALL(Query[Fruit]),[Just a count])
Does this work?