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
Hello all! I am a bit new to Power BI and I am looking for a forumla to help me with another formula. I have items that I need to count, that have the same name and are linked to data that cannot be separated. For example
Orange
Orange
Orange
Orange
Banana
Banana
Banana
Kiwi
Kiwi
Plum
Plum
So, every version of count and/or sum I have tried gives me a total of 12 here for all items, instead of returning results like the following:
Orange 4
Banana 3
Kiwi 2
Plum 2
I know this can be accomplished by visualizations, but I need either a measure or column that I can create that will would with the following formula:
RANKX(ALLSELECTED(Query [Fruit]), [Total Fruit Count], , DESC)
This formula is returning a 1 value for all of my items, even though in visualizations it is returning the proper ranking. Any help would be appreciated!
Minor Edit: The simplest way to ask this, now that I think about it, is I need something that performs what Excel does when you create a Pivot table, if possible.
Have you tried Countrows?
- HungryPowerBIer8 years agoFrequent Visitor
Count Rows does the same thing.