Forum Discussion
Anonymous
7 years agoNot applicable
Previous Week and Previous Month DAX
Hi There, I am fairly new to power BI and trying to figure this out.. I want to create a date table that will have a series how collumns that show a "Yes" or "No" value based on specfied date ran...
- 7 years ago
Hi wupdedu,
To achieve your requirement, create two calculate columns using DAX formula like pattern below:
Last Month = IF(MONTH([Date]) = MONTH(EDATE(TODAY(), -1)), "Yes", "No") Last Week = VAR Current_Week = CALCULATE(MAX([Week No]), FILTER(Table1, Table1[Date] = TODAY())) RETURN IF([Week No] = Current_Week, "Yes", "No")
Regards,
Jimmy Tao
v-yuta-msft
Community Support
7 years agoHi wupdedu,
To achieve your requirement, create two calculate columns using DAX formula like pattern below:
Last Month = IF(MONTH([Date]) = MONTH(EDATE(TODAY(), -1)), "Yes", "No") Last Week = VAR Current_Week = CALCULATE(MAX([Week No]), FILTER(Table1, Table1[Date] = TODAY())) RETURN IF([Week No] = Current_Week, "Yes", "No")
Regards,
Jimmy Tao
Anonymous
7 years agoNot applicable
Hi Jimmy,
Awesome thanks for that! The month one worked perfectly. The week one was still giving me current the current week.. I adjusted to this and seems to work giving me last week now:
Last Week = VAR Current_Week = CALCULATE(MAX([Week No]), FILTER(Table1, Table1[Date] = TODAY())) RETURN IF([Week No] +1 = Current_Week, "Yes", "No")
Thanks for your help!