Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I want to display the name of the top 5 sold items in a shop by putting each name of the item in a card (I am aware making a table is much easier but would rather get the items individually for design purposes).
So im writing a DAX measure for each top x item using the below code. The problem is that when the count for multiple items is the same, they have the same rank, so lets say rank 1 and rank 2 are the same count, rank 1 would display the item name but rank 2 would display blank. adding dense to RANKX skips the 2nd ranked item and goes directly to the 3rd which is not what i want.
I did have some sort of solution but could not implement it which was doing a seperate table with the items grouped by the count. Then i would add an index column which numbers the items in order of descending count and updates everytime the data is refreshed. If this is possible to implement if the above problem is not fixed, then that would be great.
2ndHighestItem =
VAR ItemCounts =
SUMMARIZE('My table', 'My table'[Items], "ItemCount", COUNTROWS('My table'))
VAR RankedItems =
ADDCOLUMNS(
ItemCounts,
"Rank", RANKX(ItemCounts, [ItemCount], , DESC)
)
RETURN
CALCULATE(
MAX('My table'[Items]),
FILTER(RankedItems, [Rank] = 2)
)
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
70 | |
70 | |
34 | |
23 | |
22 |
User | Count |
---|---|
96 | |
94 | |
50 | |
42 | |
40 |