Forum Discussion
ArchStanton
3 years agoPower Participant
Offset Month Calculated Column
Hi, I have a column named 'Month' which just has the dates of the 1st day of each month (see below) The MAX month as you can see is Sep 2022. I would like to create a calculated col...
- 3 years ago
Try this calculated column in the table DimDate:
Offset Month = VAR vToday = TODAY () VAR vResult = DATEDIFF ( vToday, DimDate[Date], MONTH ) + 1 RETURN vResult
DataInsights
3 years agoSuper User
Try this calculated column in the table DimDate:
Offset Month =
VAR vToday =
TODAY ()
VAR vResult =
DATEDIFF ( vToday, DimDate[Date], MONTH ) + 1
RETURN
vResult
Anonymous
3 years agoNot applicable
Hi there,
I am trying to accomplish this same thing, but I am receiving the following error. Any idea why this wouldn't be working for me?
Thanks!
- ArchStanton3 years agoPower Participant
The solution was in DAX so its meant to be used in the Data Model, I can see you're in Query Editor and that uses M language, thats a different environment.
Cancel that and instead create a calculated column using the same code in your table within the datamodel instead.
- Anonymous3 years agoNot applicable
Ah hah. That did the trick. I am still new to Power BI, so still much to learn. Thank you!
- ArchStanton3 years agoPower Participant
No problem