Forum Discussion

lasmithfla's avatar
lasmithfla
Helper I
6 years ago
Solved

Calc projected HC based on 2 variables

I need help in DAX to calculate a future HC projection.  I have 2 vairables, both are from slicers(filters).

In excel I would do the calc as follows

12MonthHCAvg * (1+Growth%) ^ No of Years

Struggling with how to write it in Dax

 

  • lasmithfla's avatar
    lasmithfla
    6 years ago

    I got it based on your blog example..

     

    HC with Growth =
    var _SelectedGrowth = Max(Growth[Growth%])
    var _SelectedYears=Max(Years[No of Years])
    Return
    CALCULATE(HC[12MonthHCAvg]*(1+_SelectedGrowth)^_SelectedYears)

3 Replies

  • Is something like this not working for you

     

    CALCULATE = 
    var _sel_G =max(selected(table[growth %]))
    var _sel_Y =max(selected(table[Year]))
    
    // Assume you have 
    return 
    [12month HC avg]*_sel_G*_sel_Y

     

     

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks.

    My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

    • lasmithfla's avatar
      lasmithfla
      Helper I

      Sorry, i'm not following; I'm pretty new to Power BI but I don't see "Selected" as an option when I'm typing in the Dax command,

      i have selectedvalue, selectedtable and a few others but not just "selected"

       

    • lasmithfla's avatar
      lasmithfla
      Helper I

      I got it based on your blog example..

       

      HC with Growth =
      var _SelectedGrowth = Max(Growth[Growth%])
      var _SelectedYears=Max(Years[No of Years])
      Return
      CALCULATE(HC[12MonthHCAvg]*(1+_SelectedGrowth)^_SelectedYears)