Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
My scenario is this:
I take end of each month a montly freeze of a set of data with last day of the month as the effective date and as a field Effective date to a table (fact_table). So thousands of rows which are linked to last day of the repective month.
I've created date table to my model using code:
Solved! Go to Solution.
The problem is that the DATEADD is returnin 28 November, which has no data. Try
Reported value 3MO Ago =
VAR CurrentDate =
LOOKUPVALUE ( 'Date'[Date], 'Date'[Is Last Effective Date], 1 )
RETURN
CALCULATE (
[Reported value],
TREATAS ( { EOMONTH ( CurrentDate, -3 ) }, 'Date'[Date] )
)
What do you get if you go into the data view and filter the date table for Is Last Effective Date = 1 ?
28.2.2023 and related field values to it.
The problem is that the DATEADD is returnin 28 November, which has no data. Try
Reported value 3MO Ago =
VAR CurrentDate =
LOOKUPVALUE ( 'Date'[Date], 'Date'[Is Last Effective Date], 1 )
RETURN
CALCULATE (
[Reported value],
TREATAS ( { EOMONTH ( CurrentDate, -3 ) }, 'Date'[Date] )
)
This solves my problem now but I will face it again in the future when number of days is not 28.
In my case best solution would probably be that instead Last Effective date = 1 returns 28.2.2023 it should return 1 to all dates in this last month (and always 1 for all days in the last reporting month). I have values only for one day for each month thus I can select all the days without numbers changing.
The code I posted should work for any month, it will get the last day of the month 3 months ago regardless of the number of days in any month.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |