Forum Discussion
Multiple Top N in the x-axis
- 5 years ago
You can create a single disconnected table like this one called 'TopNTable'.
Label TopNValue
Top 5 5 Top 10 10 Top 25 25 You can then use the Label column in your visual, and use MIN(TopNTable[TopNValue]) in a variable, and then use that variable in your TOPN measure expression
Dynamic TopN Measure =
VAR selTopN =
MIN ( TopNTable[TopNValue] )
RETURN
CALCULATE (
[your measure],
TOPN ( selTopN, DISTINCT ( Table[Clients] ), [your measure], DESC )
)Pat
Hi DataVitalizer , thanks for your reply
This graph in excel is sort of what im looking to get in powerBI. The sum of sales for 4 different topN's, by client. Hope this helps in explaining the problem
Many thanks,
-Gus
Hi Gus_C
I suggest the following steps to end up with that graph in Power BI
1. Create a calculated column in your fact table using this formula to rank the rows by numeric values
RankingColumn= RANKX(Your_Table,Numeric_Column,,DESC,Dense)
2. For each bar you will need to create a measure as below:
Top3 = CALCULATE(SUM(Numeric_Column),RankingColumn<=3)
Top10 = CALCULATE(SUM(Numeric_Column),RankingColumn<=10)
3. Drag these measures into your grouped histogram 👌
Did it work ? Mark it as a solution to help spreading knowledge.
A kudos would be appreciated
- Gus_C5 years agoFrequent Visitor
Thanks a lot DataVitalizer ,
so far works great, only issue is ranking seems to be static.
The columns in my table are: Date, client, sales
How would I change ranking column to be dynamic with date slicers?
Many thanks,
Gus