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
I've created my own Date table and marked it as such plus created a date hierarchy (and remembered to sort the columns)
Global DateTable =
ADDCOLUMNS (
CALENDARAUTO(),
"Year", YEAR([Date]),
"MonthNumber", MONTH([Date]),
"Month", FORMAT([Date], "MMMM"),
"Quarter", "Q" & QUARTER([Date]),
"WeekNumber", WEEKNUM([Date]),
"Week", "Week " & WEEKNUM([Date]),
"Weekday", FORMAT([Date], "ddd"),
"Day", FORMAT([Date], "d"),
"IsBeforeToday", IF([Date] < TODAY(), 1, 0),
"IsPreviousMonth", IF(
[Date] < EOMONTH(TODAY(), -1) + 1,
1,
0
)
)
One thing I'm missing over Time Intelligence, is I cannot access variants of the date for example accessing:
'DateTable'[Date].[Month] the .[Month] property isn't available and I get the error:
Column reference to 'Date' in table 'DateTable' cannot be used with a variation 'Month' because it does not have any.
I couldn't seem to find any documentation on how to associate my columns as variants of the Date field, this is useful when I'm calcuating previous fields in my matrix because I do the following:
VAR previousSpend =
SWITCH(
TRUE(),
ISINSCOPE('DateTable'[Date].[Month]),
CALCULATE(
SUM(usage[true_cost]),
PREVIOUSMONTH('DateTable'[Date]),
REMOVEFILTERS('DateTable'[Date])
),
ISINSCOPE('DateTable'[Date].[Quarter]),
CALCULATE(
SUM(usage[true_cost]),
PREVIOUSQUARTER('DateTable'[Date]),
REMOVEFILTERS('DateTable'[Date])
),
ISINSCOPE('DateTable'[Date].[Year]),
CALCULATE(
SUM(usage[true_cost]),
PREVIOUSYEAR('DateTable'[Date]),
REMOVEFILTERS('DateTable'[Date])
)
)
RETURN
IF (currentSpend = 0, BLANK(), (previousSpend - currentSpend))
Rather than calling REMOVEFILTERS on every field in my date hierachy.
Any ideas or am I approaching this wrong?
Solved! Go to Solution.
Hi @trevrobwhite2 .
The .Month and .Year variations are only available for built-in date hierarchies, which do not auto-generate in custom Date tables.
Rather than referring to [Date].[Month] you can use the 'Date'[Month] column in your code and your visuals, although you may want to add a year month column to the date table and use that, so that e.g. January 2024 can be distinguished from January 2025.
Also, when you are manipulating filters on the date column of a table marked as the date table you don't need to use REMOVEFILTERS explicitly, that is handled automatically. You could rewrite your code as
VAR previousSpend =
SWITCH (
TRUE (),
ISINSCOPE ( 'DateTable'[Month] ), CALCULATE ( SUM ( usage[true_cost] ), PREVIOUSMONTH ( 'DateTable'[Date] ) ),
ISINSCOPE ( 'DateTable'[Quarter] ), CALCULATE ( SUM ( usage[true_cost] ), PREVIOUSQUARTER ( 'DateTable'[Date] ) ),
ISINSCOPE ( 'DateTable'[Year] ), CALCULATE ( SUM ( usage[true_cost] ), PREVIOUSYEAR ( 'DateTable'[Date] ) )
)
RETURN
IF ( currentSpend = 0, BLANK (), ( previousSpend - currentSpend ) )
Hi @trevrobwhite2 ,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster .
Thank you very much for your kind cooperation!
Best Regards,
Dengliang Li
Rather than referring to [Date].[Month] you can use the 'Date'[Month] column in your code and your visuals, although you may want to add a year month column to the date table and use that, so that e.g. January 2024 can be distinguished from January 2025.
Also, when you are manipulating filters on the date column of a table marked as the date table you don't need to use REMOVEFILTERS explicitly, that is handled automatically. You could rewrite your code as
VAR previousSpend =
SWITCH (
TRUE (),
ISINSCOPE ( 'DateTable'[Month] ), CALCULATE ( SUM ( usage[true_cost] ), PREVIOUSMONTH ( 'DateTable'[Date] ) ),
ISINSCOPE ( 'DateTable'[Quarter] ), CALCULATE ( SUM ( usage[true_cost] ), PREVIOUSQUARTER ( 'DateTable'[Date] ) ),
ISINSCOPE ( 'DateTable'[Year] ), CALCULATE ( SUM ( usage[true_cost] ), PREVIOUSYEAR ( 'DateTable'[Date] ) )
)
RETURN
IF ( currentSpend = 0, BLANK (), ( previousSpend - currentSpend ) )
Hi @trevrobwhite2 .
The .Month and .Year variations are only available for built-in date hierarchies, which do not auto-generate in custom Date tables.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 73 | |
| 50 | |
| 46 | |
| 44 |