Forum Discussion
Last month and Last Week DAX Formulas
- Anonymous7 years ago
Hi Xioxin,
Thanks for the reply. I tried that and still get the same error.
The "," is working when I use it in other formulas. Example this works:
Yesterday =
IF (
YEAR ( [Date] ) = YEAR ( TODAY () )
&& DAY ( [Date] ) = DAY ( TODAY () -1 ),
"Yes",
"No"
)
Perhaps:
Last Month = IF ( YEAR ( [Date] ) = YEAR ( TODAY () ) && MONTH( [Date] ) = MONTH( TODAY ()) -1 ), "Yes", "No" )
Last Week =
IF (
YEAR ( [Date] ) = YEAR ( TODAY () )
&& WEEKNUM ( [Date] ) = WEEKNUM ( TODAY ()) -1 ),
"Yes",
"No"
)
- Anonymous7 years agoNot applicable
Hi Greg,
Thank you for your reply. I tried your suggestion but I get the following error
The syntax for ',' is incorrect. (DAX(IF (YEAR ( [Date] ) = YEAR ( TODAY () )&& MONTH( [Date] ) = MONTH( TODAY ()) -1 ),"Yes","No"))).
Thanks
- Anonymous7 years agoNot applicable
Hi Anonymous,
It seems like your system not support ',' as separator, you can try to use ';' to instead ','.
Regards,
Xiaoxin Sheng
- Anonymous7 years agoNot applicable
Hi Xioxin,
Thanks for the reply. I tried that and still get the same error.
The "," is working when I use it in other formulas. Example this works:
Yesterday =
IF (
YEAR ( [Date] ) = YEAR ( TODAY () )
&& DAY ( [Date] ) = DAY ( TODAY () -1 ),
"Yes",
"No"
)
- Anonymous7 years agoNot applicable
Hi, how will you obtain the first date and last dates of last 2 weeks for the first , second and third weeks of January?