Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
For today I'm using
Today= DATE(YEAR(NOW()),MONTH(NOW()), DAY(NOW())
How would I display Today last year? I was thinking
TodayPrevYear = DATE(YEAR(NOW()-1),MONTH(NOW()), DAY(NOW())
But I get an error.
Can someone show me the correct formula to use for Today Last year?
Solved! Go to Solution.
Perhaps something like:
Measure = DATE(YEAR(NOW())-1,MONTH(NOW()), DAY(NOW()-1))
You have to subtract 1 from the result of the YEAR function not inside the argument!
If you do YEAR ( NOW()-1 ) as you you've done you are basically asking for the function to return the YEAR of NOW()-1
which would be yesterday this year - thats why you have to get the year first and then subtract 1
TodayPrevYear = DATE ( YEAR ( NOW () ) - 1, MONTH ( NOW () ), DAY ( NOW () ) )
And same if you want yesterday previous year
Obviously for Day it won't matter if you subtract 1 inside or not
YesterdayPrevYear = DATE ( YEAR ( NOW () ) - 1, MONTH ( NOW () ), DAY ( NOW () ) - 1 )
Hope this helps!
Hi, You can also obtain:
Today-inPreviousYear = EDATE(TODAY(),-12)
Yesterday-inPreviousYear = EDATE(TODAY(),-12)-1
You have to subtract 1 from the result of the YEAR function not inside the argument!
If you do YEAR ( NOW()-1 ) as you you've done you are basically asking for the function to return the YEAR of NOW()-1
which would be yesterday this year - thats why you have to get the year first and then subtract 1
TodayPrevYear = DATE ( YEAR ( NOW () ) - 1, MONTH ( NOW () ), DAY ( NOW () ) )
And same if you want yesterday previous year
Obviously for Day it won't matter if you subtract 1 inside or not
YesterdayPrevYear = DATE ( YEAR ( NOW () ) - 1, MONTH ( NOW () ), DAY ( NOW () ) - 1 )
Hope this helps!
Hi, You can also obtain:
Today-inPreviousYear = EDATE(TODAY(),-12)
Yesterday-inPreviousYear = EDATE(TODAY(),-12)-1
How would you today in previous year for FiscalDayOfYear ?
Perhaps something like:
Measure = DATE(YEAR(NOW())-1,MONTH(NOW()), DAY(NOW()-1))
Thank you Greg, so helpful.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
95 | |
86 | |
78 | |
66 |
User | Count |
---|---|
150 | |
118 | |
111 | |
106 | |
95 |