Forum Discussion

ChuckChuck's avatar
ChuckChuck
Icon for Helper I rankHelper I
5 years ago

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

  • 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.

  • v-easonf-msft's avatar
    v-easonf-msft
    Icon for Community Support rankCommunity 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

    • ChuckChuck's avatar
      ChuckChuck
      Icon for Helper I rankHelper I

      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.