Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm using the Top N filter for top 10 in a ribbon chart. It's picking up the top 10 values numerically across the three months I've filtered, but what I'm looking for is to find the top 10 for the most recent month in the filter (June below) and then show those 10 going back to the start date (April below). Hope that makes sense. Is there a way to do this natively, or does it require filtering on a custom measure? If so, what might that measure look like with a field [Date] and [Category]?
Hi @mateoc15 ,
Please check whether the below screen shot is what you want:
1. Create a measure
Top 10 for most recent month =
VAR _rank =
RANKX (
ALLEXCEPT ( 'Ribbon chart', 'Ribbon chart'[Date] ),
CALCULATE ( SUM ( 'Ribbon chart'[Rate] ) ),
,
DESC,
DENSE
)
RETURN
IF ( _rank <= 10, MAX ( 'Ribbon chart'[Rate] ), BLANK () )
2. Apply the new created measure onto ribbon chart
If the above ones is not what you want, please provide your expected result and explain more details with examples. Thank you.
Best Regards
Rena
Maybe I'm just not using your work correctly, but I don't think it's what I'm looking for.
To maybe state the desired outcome differently, I want the top 10 for June, then the ribbon (or whatever viz) just show me what those same 10 looked like in April and May. Those 10 might not be top 10 across the 3 month period, but I want to know details about the ones that are currently (if June is current month) top 10.
I took a shot at a DAX calculation based on what you provided but no luck.
Hi @mateoc15 ,
You can create 3 measures as below:
Rank =
var _mdate=CALCULATE(MAX('Table'[Date]),ALL('Table'))
VAR _rank =
RANKX (
ALLEXCEPT ( 'Table', 'Table'[Date] ),
CALCULATE ( SUM ( 'Table'[Rate] ) ),
,
DESC,
DENSE
)
RETURN
_rank
Top 3 Category =
var _mdate=CALCULATE(MAX('Table'[Date]),ALL('Table'))
VAR _tempTab= CALCULATETABLE(DISTINCT('Table'[Category]),FILTER(ALL('Table'),[Rank]<=3&&'Table'[Date]=_mdate))
var _category=CALCULATE(CONCATENATEX(_tempTab,[Category],","),ALL('Table'))
return _category
Measure =
VAR mymeasure=SUBSTITUTE([Top 3 Category],",","")
VAR Mylen=len(mymeasure)
VAR mytable=ADDCOLUMNS(GENERATESERIES(1,mylen),"mylist",(Mid(mymeasure,[Value],1)))
VAR mylist=SELECTCOLUMNS(mytable,"list",[mylist])
RETURN
CALCULATE(SUM('Table'[Rate]),FILTER('Table','Table'[Date]=MAX('Table'[Date])&&'Table'[Category] in mylist))
Best Regards
Rena
Hi @Anonymous , thank you for this DAX sytax. The only problem I am facing to do the same is that ,my categories are not letters, they are words and phrases sometimes. How do you address this? Thank you.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |