Forum Discussion
immkhan
6 years agoFrequent Visitor
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...
- 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])
Greg_Deckler
Community Champion
6 years agoimmkhan - 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])
immkhan
6 years agoFrequent Visitor
Thanks for the reply and it is working. The only thing which is remaining is the second line. The graph is changing on the same line but I want to have default line at 0 days and second line on user selection.
Regards
Imran