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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ChuckChuck
Helper I
Helper I

Max Age for Bottom 80%, Based On Current Filter Context

I have a table with millions of records where I'm trying to dynamically arrive at the max [Age] by [As of Date], but filtered to only where the [Running Total] is less than 80% of the [Date Total]. So in this example, the result is 35. My visual will list 12 dates with the max age just before the 80% threshold is reached within the current filter context. If the user filters on [Acct #], the result will update based on the current context. I've been able to get a version of a measure to work, but it takes 1+ mins to run.

    MeasureMeasureMeasure
As of DateAcct #AgeAmtRunning TotalDate TotalRunning Total %
11/1/20201230$5,486.00$5,486.00$25,941.0021.15%
11/1/202012315$8,648.00$14,134.00$25,941.0054.49%
11/1/202012321$748.00$14,882.00$25,941.0057.37%
11/1/202012335$3,314.00$18,196.00$25,941.0070.14%
11/1/202012340$7,745.00$25,941.00$25,941.00100.00%

 

4 REPLIES 4
v-easonf-msft
Community Support
Community Support

Hi, @ChuckChuck 

Maybe you can take a try to store the temporary table in a var variable ,

Max Age <80% Threshold =
VAR tab =
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[As of Date],
            'Table'[Age],
            "RT %", [Running Total %]
        ),
        [Running Total %] < .8
    )
RETURN
    MAXX ( tab, 'Table'[Age] )

or change the temporary table  to a calculated table  before you need to call the table in the measure( although this will take up some storage )

 

Best Regards,
Community Support Team _ Eason

Thank you, @v-easonf-msft! Unfortunately, this solution doesn't produce an improved result. My existing measure takes ~2.43 minutes to run, while your suggestion takes ~2.42 minutes to run. The second suggestion to have a table with the stored values won't work because users will need to apply filters from the filter pane and see the max aged days update accordingly, so I need something dynamic against the full table in the current filter context. 

parry2k
Super User
Super User

@ChuckChuck can you share what existing measure you are using? Also if possible share sample pbix file to look into it.

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hello @parry2k ,

 

PBIX: https://1drv.ms/u/s!AqaBEhuP2H_olAOBkyTxlctZXCWa?e=ONJJxS

Measure: 

Max Age <80% Threshold =
MAXX(FILTER(SUMMARIZE('Table', 'Table'[As of Date], 'Table'[Age], "RT %", [Running Total %]), [Running Total %]<.8), 'Table'[Age])
 
When this measure is used in my dataset that is millions of rows, it takes a very long time to return the results.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.