Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
vegetablevixen
Regular Visitor

Want TopN for date range selected in filter, but don't want members to change per month in chart

I have a report with a time slicer so the user can find the Top 5 operators for the time period, and see the values for each of those top 5 and "Other" in a chart below. The Top5 and other DAX I found online seems to work over the whole slicer period; however, when I use it in a chart that's split by month, the Top5 and other is calculated per month, resulting in more than 5 members in the legend (since there's a different Top5 for each month). 

 

What I want to do is create a set of the Top 5 and Other operators for the time period selected on the slicer (which will change), yet have that same set show per month in the chart. I've included a screenshot of the problem and the DAX I'm using for the Top5 and other. Can you help me with how to define this "set" so it will work correctly in the chart?

 

https://www.dropbox.com/s/56uer1dy5yop1b8/top5%20and%20other%20illustration%20of%20problem.JPG?dl=0

 

https://www.dropbox.com/s/c4x07huscdt2zz4/the%20working%20top5%20and%20other%20DAX.txt?dl=0 

1 REPLY 1
benmac
Frequent Visitor

try appending var top5 by adding ALL(DATETABLE) to the end like this

var top5 = CALCULATETABLE(TOPN(5,VALUES(DisposalWell[OperatorName]),CALCULATE(SUM(WellCompletionInjection[ProductionAmount]),ALL(DATETABLE))))

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors