Forum Discussion
sdas028
7 years agoHelper I
IF Statement DAX Month
Hi, I have a date field in a large table of data, I want to have an IF statement in an added column where it says Yes if the month (or date) is equal to or less than todays date and No if it isnt...
- 7 years ago
Hi sdas028 ,
We can create a calculated column to make sure the reuslt is correct if there are different years in your fact table.
YTD = var monthyear = YEAR(Table1[Posting date])*100+MONTH(Table1[Posting date]) var _today = YEAR(TODAY())*100+MONTH(TODAY()) return IF(monthyear<=_today,"Yes","No")
For more details, please check the pbix as attached.
Regards,
Frank
v-frfei-msft
7 years agoCommunity Support
sdas028
7 years agoHelper I
Hi Frank,
Yes absolutely! This is actually what I ended up using for the solution so thank you very much! :)
Apologies I always forget to go back and close off the request, will do that now
Thanks,
Sophie