Forum Discussion
UCHKANA
4 years agoNew Member
DATEDIFF function with Filter
Hello all, I wanted to calulcate the date difference but with the filter. I wrote the following but it doesn't work. MEASURE = IF((max(OpportunityBase[StatusCode])=100000023), (DATEDIFF(TODAY(...
- 4 years ago
What are you doing with FIRSTDATE()? That is a time intelligence function.
This measure will functionally work, but I am not sure it will give you the results are are wanting. You should not use time intelligence functions to do date math. If you are using it intentionally knowing that it invokes context transition, that is fine, otherwise, use MIN() instead, or post back with more info.
Some Measure = VAR varStartDate = TODAY() VAR varEndDate = FIRSTDATE( 'OpportunityBase'[Close By] ) RETURN IF( MAX( OpportunityBase[StatusCode] ) = 100000023, DATEDIFF( varStartDate, varEndDate, DAY ) ) - Anonymous4 years ago
Try the following to see if it works:
Measure Name =
VAR _max = MAX( OpportunityBase[StatusCode] )
VAR _date = FIRSTNONBLANK( 'OpportunityBase'[Close By] , 1)
RETURN
IF ( _max = 100000023 ,
DATEDIFF( TODAY(), _date , DAY ) ,
BLANK()
)
Anonymous
4 years agoNot applicable
Try the following to see if it works:
Measure Name =
VAR _max = MAX( OpportunityBase[StatusCode] )
VAR _date = FIRSTNONBLANK( 'OpportunityBase'[Close By] , 1)
RETURN
IF ( _max = 100000023 ,
DATEDIFF( TODAY(), _date , DAY ) ,
BLANK()
)
- UCHKANA4 years agoNew Member
Omggg. It totally worked! Thank you soo much! ❤️