Forum Discussion
Anonymous
6 years agoNot applicable
Integrate a condition in a VAR Function
Hello everyone,
I would like to integrate a IF in the RETURN of a VAR expression. I explain myself,
This is my current fonction VAR (without the IF):
To Year End =
VAR StartingDate = FIRSTDATE ( 'Dates'[Date] )
VAR EndingDate = DATE ( YEAR ( StartingDate ), 12, 31 )
RETURN
CALCULATE(
[Projection],
'Dates'[Date] >= StartingDate && 'Dates'[Date] <= EndingDateBut I would like to integrate in the calculate a IF. That is to say,
RETURN
IF(day(today())<=8; CALCULATE([Projection],'Dates'[Date] >= StartingDate && 'Dates'[Date] <= EndingDate.
Could you please help me because it does not accept the IF. Thanks you.
3 Replies
- parry2kSuper User
Anonymous try following. also can you share what error message you are getting
To Year End = VAR StartingDate = FIRSTDATE ( 'Dates'[Date] ) VAR EndingDate = DATE ( YEAR ( StartingDate ), 12, 31 ) RETURN IF ( DAY( TODAY() ) <= 8, CALCULATE( [Projection], 'Dates'[Date] >= StartingDate , 'Dates'[Date] <= EndingDate ) )