Forum Discussion
Anonymous
6 years agoNot applicable
DAX Switch / IF
Hi,
Could I please double check if this is the right syntax to use, or should it be a switch statement?
test =
IF(
DATEDIFF(DATEADD(vw1[DateUpdated],-1, MONTH), vw1[CreatedDate], MONTH) = 0
&&
DATEDIFF(DATEADD(vw1[DateUpdated],-1, MONTH), vw1[TargetDate], MONTH) = 0,1,0)
DATEDIFF(DATEADD(vw1[DateUpdated],-1, MONTH), vw1[TargetDate], MONTH) = 0,1,0)
Im not sure whether its taking in the second part of the statement.
Any help would be greatly appreciated.
Thanks
Liam
Yeah, that syntax is fine, you don't have nested IF statements and not sure a SWITCH statement would make things much cleaner. Whether or not the code works, would need to see sample data to test.
2 Replies
- Pragati11Super User
Hi Anonymous ,
The syntax looks right. Can you share if it is not working?
Thanks,
Pragati
- Greg_DecklerCommunity Champion
Yeah, that syntax is fine, you don't have nested IF statements and not sure a SWITCH statement would make things much cleaner. Whether or not the code works, would need to see sample data to test.