Forum Discussion

immkhan's avatar
immkhan
Frequent Visitor
6 years ago
Solved

What-If on Date Column

Hi,   I have to apply the What-if scenario on Date but unable to do so. My data is like: (All are data and calculated columns; no Measures)   Product       Lot            Total_Shelf_Life       R...
  • Greg_Deckler's avatar
    6 years ago

    immkhan - It is hard to explain the solution so I have opted to just present a PBIX file (attached below sig). The measure used is below:

     

    Measure 2 = 
        VAR __Adjustment = SELECTEDVALUE('Adjusted'[Adjusted])
        VAR __Bracket = SELECTEDVALUE('Brackets'[Bracket])
        VAR __High = 
            SWITCH(__Bracket,
                "Below 25%",.25,
                "25% - 50%",.50,
                "50% - 75%",.75,
                1
            )
        VAR __Low =
            SWITCH(__Bracket,
                "Below 25%",0,
                "25% - 50%",.2500001,
                "50% - 75%",.5000001,
                .75000001
            )
        VAR __Table =
            ADDCOLUMNS(
                'Table',
                "__Rem_Shelf_Life%",([Rem_Shelf_Life] + __Adjustment) / [Total_Shelf_Life]
            )
    RETURN
        SUMX(FILTER(__Table,[__Rem_Shelf_Life%] >= __Low && [__Rem_Shelf_Life%]<=__High),[Quantity])