Forum Discussion
queryuser
4 years agoHelper I
Display first date based on multiple if statements
Hello everyone, Question: How do I display the first Date using DAX when either Production A or Production B exceeds the values in the Forecast culumn? Thank you!
- 4 years ago
queryuser you can use this measure
Measure = MINX ( CALCULATETABLE ( VALUES ( 'Table'[Date] ), FILTER ( 'Table', VAR _prodA = CALCULATE ( SUM ( 'Table'[Prod A] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) ) VAR _prodB = CALCULATE ( SUM ( 'Table'[Prod B] ), ALLEXCEPT ( 'Table', 'Table'[Prod B] ) ) VAR _forecast = CALCULATE ( SUM ( 'Table'[Forecast] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) ) RETURN _prodA > _forecast || _prodB > _forecast ) ), 'Table'[Date] )
smpa01
4 years agoCommunity Champion
queryuser you can use this measure
Measure =
MINX (
CALCULATETABLE (
VALUES ( 'Table'[Date] ),
FILTER (
'Table',
VAR _prodA =
CALCULATE ( SUM ( 'Table'[Prod A] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) )
VAR _prodB =
CALCULATE ( SUM ( 'Table'[Prod B] ), ALLEXCEPT ( 'Table', 'Table'[Prod B] ) )
VAR _forecast =
CALCULATE ( SUM ( 'Table'[Forecast] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) )
RETURN
_prodA > _forecast
|| _prodB > _forecast
)
),
'Table'[Date]
)