Automationscribe.com
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us
No Result
View All Result
Automation Scribe
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us
No Result
View All Result
Automationscribe.com
No Result
View All Result

Learn how to Implement Three Use Circumstances for the New Calendar-Based mostly Time Intelligence

admin by admin
November 25, 2025
in Artificial Intelligence
0
Learn how to Implement Three Use Circumstances for the New Calendar-Based mostly Time Intelligence
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


Introduction

about Time Intelligence in DAX prior to now.

Nonetheless, the brand new Calendar-based Time Intelligence function rewrites the rulebook, as some ideas will change, and the required methods might be less complicated than earlier than.

Anyway, the time intelligence features stay the identical, despite the fact that we should use them barely in another way. However nearly all the things might be simpler than earlier than.

On this piece, I’ll focus on three use instances for which I’d have wanted to jot down complicated DAX code.

Now, let’s focus on the use instances.

Use-Circumstances

Monetary calendar

When working with monetary information, it might be essential to account for greater than 12 months to handle further bookings. Some corporations used such further months to make sure consistency with the common bookings.

Till now, this has solely been attainable with customized DAX code.

Now we will create a customized calendar and use the usual time intelligence features with it.

This use case has the next necessities:

  1. We should cowl 15 months per yr.
  2. We want two views: One for the reserving months and one the place the extra months are mapped to December.
  3. We’re PY information; we should see all days, together with leap years (29th of February).

Weekly calculations

I already wrote about weekly calculations. It concerned customized DAX code, as there was no WDT operate, and it wasn’t attainable to calculate the earlier yr based mostly on weeks.

Once more, this could now be completed simply with a calendar that incorporates week data, together with the brand new TOTALWTD() and DATESWTD() features.

Weekly Calculation with Fiscal Years

Weekly Calculations are much more difficult after we should account for fiscal years that don’t match calendar years.

Even such a state of affairs can now be solved with commonplace time intelligence features when the calendar desk incorporates the right data.

Conditions

The primary prerequisite is to allow the Preview function:

Determine 1 – Enabling the Preview function in Energy BI Desktop (Determine by the Creator)

One other prerequisite is to create a date desk that covers the required intervals.

As earlier than, a well-crafted date desk is vital for working with Time Intelligence, and now much more so with the brand new function.

When working with the brand new Time Intelligence prospects, we’d like three steps:

  1. We construct a date desk and outline which columns we have to cowl every use case.
  2. Then we outline a calendar for this desk by assigning the columns to the intervals, like yr, quarter, months, weeks, and dates.
  3. Create DAX measures utilizing the calendar outlined in step 2.

The primary two steps are equally essential, because the desk have to be fastidiously crafted to cowl the required intervals.

The calendar definition permits us to make use of the columns within the date desk to assign them to predefined classes. Shortly, you will note what this implies.

I’ll describe the content material of the date desk with pattern information for every use case.

Case 1: Monetary Calendar

To begin with, I create a desk containing the next data:

  • Years
  • Semesters (1 & 2 plus a 3rd for the extra months)
  • Quarters (1 – 4 and a fifth Quarter for the extra months) 
  • Month 1 – 15
  • Month Names for all 15 months (Jan – Dec, and Further Month 1 – 3)
  • 31 Days for every month, even for the months that usually have fewer than 31 days
  • The Quarter and the Months the place the Further months are mapped to December

That is the way it appears with two examples per column:

Column Identify Instance
ID_Date 20060101
20061301
Date_Real 2006.01.01
N/A
12 months 2006
ID_Month 200601
200613
Month 1
13
Day 1
Date_German 01.01.2006
01.13.2006
Date_EN 01/01/2006
01/13/2006
MonthName January
Further Month 1
MonthNameShort Jan
Add Month 1
YearMonthName January 2006
Further Month 1 2006
YearMonthNameShort Jan 2006
Add Month 1 2006
Semester 1
3
SemesterName Semester 1
Semester 3
YearSemester 20061
20063
YearSemesterName Semester 1 2006
Semester 3 2006
Quarter 1
5
QuarterName Quarter 1
Quarter 5
YearQuarter 20061
20065
YearQuarterName Quarter 1 2006
Quarter 5 2006
CalendarMonth 1
12
CalendarMonthName January
December
CalendarMonthNameShort Jan
Dec
CalendarYearMonth 200601
200612
CalendarYearMonthName January 2006
December 2006
CalendarYearMonthNameShort Jan 2006
Dec2006

The 2 examples are one for January and one for the primary further month.

Right here, a distinct view of the info for the extra columns and rows:

Determine 2 – Examples for the columns for the extra months (Determine by the Creator)

In my case, I’ve constructed this desk in SQL, however it may be completed in another programming language, together with Energy Question.
You solely want a number of lists of numbers and mix them.

You will discover an instance of mix tables with lists of numbers on this article.

However the important thing level is that I’m free to outline the Calendar’s content material. Even the Date column doesn’t have to comprise actual dates, as, in my case, there are solely strings in it.

After importing the brand new calendar into Energy BI, we will open the brand new “Calendar choices” dialog after clicking on the desk:

Determine 3 – Open the brand new Calendar choices dialog in Energy BI Desktop (Determine by the Creator)

Now, I’ll create two new calendars.

Please word that I can’t set the brand new desk as a date desk, because it incorporates non-existent “dates”, akin to 30. February.

I click on on “Add Class” so as to add, for instance, the 12 months, Month, and Month of 12 months, and assign the columns with the info to them:

Determine 4 – The definition of the Monetary calendar with the brand new Calendar choices (Determine by the Creator)

When establishing the calendar, keep in mind to click on on the “Validate information” button after including every class. This helps you to find errors within the information, in the event that they exist.

This button checks whether or not every worth has a many-to-one relationship to every worth within the class above.

For instance, every month should belong to at least one yr. The class “Month” should comprise the month and the yr, whereas the “Month of the 12 months” should comprise solely the month.

As the first column, I chosen the ID columns, and for the Related columns, I chosen the naming columns with completely different codecs and languages.

Please examine the hyperlinks within the References part under for detailed details about how this function works.

To have a calendar, the place the extra months are assigned to December, I arrange the next Calendar:

Determine 5 – Configuration of the Monetary (Actual) Calendar (Determine by the Creator)

I didn’t arrange columns for the Quarter within the “Actual” calendar as a result of I don’t want them in my state of affairs.

To calculate the PY for On-line Gross sales, I can use the SAMEPERIODLASTYEAR() operate. However as an alternative of utilizing a Date column, I move the identify of the Monetary calendar:

On-line Gross sales Fin PY = 
CALCULATE([Sum Online Sales],
            SAMEPERIODLASTYEAR('Financial_Calendar')
            )

When trying on the outcomes for the intercalary year, I get this:

Determine 6 – The PY worth for the yr after a intercalary year (Determine by the Creator)

And when trying on the outcomes for the extra months, I get this:

Determine 7 – Outcomes for the extra months. On the left, you see the extra months. On the best, you see the sum of December plus the extra months added collectively and assigned to December (Determine by the Creator)

As you may see, the PY is calculated appropriately for the extra months.

As well as, in the best desk, you may see the values from December and the extra months (from the left desk) added collectively into December by utilizing the “Actual” calendar.

To have such an answer with a easy measure is groundbreaking.

Now, let’s have a look at weekly calculations.

Case 2: Weekly Calculation

This time, I need to calculate the PY per week.

As I already confirmed outline customized calendars, I’ll solely present you the content material of the concerned columns and the way they’re assigned to the calendar.

This time, I used current columns from my date desk:

YearOfWeek WeekKey 12 months/Week Week Date Day of Week Day of Week Identify
2025 202501 2025/1 1 30/12/2024 1 Monday
2025 202501 2025/1 1 31/12/2024 2 Tuesday
2025 202501 2025/1 1 01/01/2025 3 Wednesday
2025 202501 2025/1 1 02/01/2025 4 Thursday
2025 202501 2025/1 1 03/01/2025 5 Friday
2025 202501 2025/1 1 04/01/2025 6 Saturday
2025 202501 2025/1 1 05/01/2025 7 Sunday
2025 202552 2025/52 52 22/12/2025 1 Monday
2025 202552 2025/52 52 23/12/2025 2 Tuesday
2025 202552 2025/52 52 24/12/2025 3 Wednesday
2025 202552 2025/52 52 25/12/2025 4 Thursday
2025 202552 2025/52 52 26/12/2025 5 Friday
2025 202552 2025/52 52 27/12/2025 6 Saturday
2025 202552 2025/52 52 28/12/2025 7 Sunday

As you may see, the [YearOfWeek] column is tied to the week, not the calendar yr. I did this to make sure the right task of the week to the 12 months. With out this, the Calendar Validation would have failed, because the [WeekKey] column for the primary calendar week of every yr would have been assigned to 2 completely different years.

This exhibits how essential it’s to construct a constant calendar desk.

Right here is the definition of the weekly calendar:

Determine 8 – Definition of the Weekly calendar (Determine by the Creator)

And listed below are the outcomes for the measure utilizing this calendar:

Determine 9 – Outcomes utilizing a easy measure utilizing SAMEPERIODLASTYEAR() and the Weekly Calendar (Determine by the Creator)

As earlier than, the measure makes use of a easy SAMEPRIODLASTYEAR() name and makes use of the newly created “Weekly Calendar”:

On-line Gross sales PY Week = CALCULATE([Sum Online Sales]
                                ,SAMEPERIODLASTYEAR( 'Weekly Calendar' )
                                )

Evaluate this to the complicated code you had earlier than introducing this new function to calculate a constant weekly-based PY measure.

Listed here are the outcomes of a measure utilizing the brand new WTD measures:

Determine 10 – Outcomes for the WTD Measures (Determine by the Creator)

Listed here are the measures used:

On-line Gross sales WTD = 
    VAR WtdDates = DATESWTD('Weekly Calendar')

RETURN
    CALCULATE([Sum Online Sales]
                ,WtdDates
                )
On-line Gross sales PY WTD = 
    CALCULATE([Online Sales WTD]
                ,SAMEPERIODLASTYEAR('Weekly Calendar')
                )

It’s nearly unbelievable how simple it’s to create these measures.

Case 3: Weekly Calculation with Fiscal Years

This one is extra complicated.

On this case, the Fiscal 12 months begins on the primary day of August.

Which means the primary week of the Fiscal yr is the week with the Fiscal yr’s first day.

I arrange all of the columns within the Date desk; that is an extract of the wanted columns:

FiscalYear ForWeek FiscalYear WeekSort FiscalWeekSort Fiscal Week/12 months Fiscal Week Date FiscalDay OfWeek Day of Week Identify
25/26 252601 1 1 – 25/26 1 28/07/2025 1 Monday
25/26 252601 1 1 – 25/26 1 29/07/2025 2 Tuesday
25/26 252601 1 1 – 25/26 1 30/07/2025 3 Wednesday
25/26 252601 1 1 – 25/26 1 31/07/2025 4 Thursday
25/26 252601 1 1 – 25/26 1 01/08/2025 5 Friday
25/26 252601 1 1 – 25/26 1 02/08/2025 6 Saturday
25/26 252601 1 1 – 25/26 1 03/08/2025 7 Sunday
25/26 252652 52 52 – 25/26 52 20/07/2026 1 Monday
25/26 252652 52 52 – 25/26 52 21/07/2026 2 Tuesday
25/26 252652 52 52 – 25/26 52 22/07/2026 3 Wednesday
25/26 252652 52 52 – 25/26 52 23/07/2026 4 Thursday
25/26 252652 52 52 – 25/26 52 24/07/2026 5 Friday
25/26 252652 52 52 – 25/26 52 25/07/2026 6 Saturday
25/26 252652 52 52 – 25/26 52 26/07/2026 7 Sunday

Once more, I will need to have an extra column for the Fiscal 12 months assigned to the weeks.

However this time, I have to create a separate desk with the wanted columns. For some cause, utilizing these columns from the Date desk doesn’t work. Any try to make use of these columns resulted in a bizarre impact.

You may learn extra about this right here.

Ultimately, I added a calculated desk with the wanted columns:

Fiscal-Week Date = 
CALCULATETABLE(
		SUMMARIZECOLUMNS(
				'Date'[FiscalYearForWeek]
				,'Date'[Fiscal Week/Year]
				,'Date'[FiscalWeekSort]
				,'Date'[Day of Week Name]
				,'Date'[Day of Week]
				,'Date'[Date]
				,'Date'[DateKey])
            ,NOT ISBLANK('Date'[FiscalYearForWeek] )
            )

The calendar created on this desk appears like this:

Determine 11 – Configuration of the Fiscal-Week calendar (Determine by the Creator)

The measure to calculate the Gross sales for the earlier yr is, once more, easy:

On-line Gross sales PY (Fiscal Week) = 
    CALCULATE([Sum Online Sales]
                ,SAMEPERIODLASTYEAR('Fiscal-Week Calendar')
                )

These are the outcomes:

Determine 12 – Outcomes for the PY of the Fiscal Week Calendar (Determine by the Creator)

You may see that the consequence aligns completely with the week and weekday of the earlier yr, despite the fact that the dates are shifted.

That is precisely what I anticipated.

Conclusion

This new function modifications all the things concerning Time Intelligence with DAX.

However, though we will simplify our DAX measures, we should take further care when crafting our date tables. It’s all about having the right content material.

It’s fascinating that Microsoft already recommends utilizing this function, despite the fact that it’s solely been obtainable for just a few months since its introduction as a Preview function.

My advice is to look into it. Learn the articles linked under. Take a look at it along with your particular situations and determine whether or not it’s value switching current options to this function.

I completely will use this function when beginning new options.

The one downside is that it could improve the variety of date tables within the information mannequin. Till now, I’ve used a single central date desk for all the things. Now, I could have to create separate date tables for particular situations. However this could introduce complexity when combining completely different features of the info mannequin. This may introduce further challenges in deciphering the info.

Consider it for one second:

Is it actually a good suggestion to have two completely different calendars on one web page? Are the outcomes nonetheless comparable? Can this confuse your customers?

I’ll completely keep away from such situations. Evaluating outcomes by month and by week on the identical pages, and even in the identical report, makes little sense to me.

Keep tuned for extra content material on this subject. Will write extra about it over time after I encounter fascinating situations.

References

Right here, the Microsoft documentation for calendar-based time intelligence: Implement time-based calculations in Energy BI – Energy BI | Microsoft Study.

This SQL BI article explains this new function in nice element: Introducing Calendar-based Time intelligence in DAX – SQLBI.

Like in my earlier articles, I take advantage of the Contoso pattern dataset. You may obtain the ContosoRetailDW Dataset free of charge from Microsoft right here.

The Contoso Information can be utilized freely below the MIT License, as described on this doc. I modified the dataset to shift the info to up to date dates.

Tags: CalendarBasedcasesImplementIntelligencetime
Previous Post

Speed up generative AI innovation in Canada with Amazon Bedrock cross-Area inference

Next Post

Amazon SageMaker AI introduces EAGLE based mostly adaptive speculative decoding to speed up generative AI inference

Next Post
Amazon SageMaker AI introduces EAGLE based mostly adaptive speculative decoding to speed up generative AI inference

Amazon SageMaker AI introduces EAGLE based mostly adaptive speculative decoding to speed up generative AI inference

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Popular News

  • How Aviva constructed a scalable, safe, and dependable MLOps platform utilizing Amazon SageMaker

    How Aviva constructed a scalable, safe, and dependable MLOps platform utilizing Amazon SageMaker

    402 shares
    Share 161 Tweet 101
  • Unlocking Japanese LLMs with AWS Trainium: Innovators Showcase from the AWS LLM Growth Assist Program

    402 shares
    Share 161 Tweet 101
  • Speed up edge AI improvement with SiMa.ai Edgematic with a seamless AWS integration

    402 shares
    Share 161 Tweet 101
  • The Journey from Jupyter to Programmer: A Fast-Begin Information

    402 shares
    Share 161 Tweet 101
  • The right way to run Qwen 2.5 on AWS AI chips utilizing Hugging Face libraries

    402 shares
    Share 161 Tweet 101

About Us

Automation Scribe is your go-to site for easy-to-understand Artificial Intelligence (AI) articles. Discover insights on AI tools, AI Scribe, and more. Stay updated with the latest advancements in AI technology. Dive into the world of automation with simplified explanations and informative content. Visit us today!

Category

  • AI Scribe
  • AI Tools
  • Artificial Intelligence

Recent Posts

  • Why CrewAI’s Supervisor-Employee Structure Fails — and Easy methods to Repair It
  • Amazon SageMaker AI introduces EAGLE based mostly adaptive speculative decoding to speed up generative AI inference
  • Learn how to Implement Three Use Circumstances for the New Calendar-Based mostly Time Intelligence
  • Home
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms & Conditions

© 2024 automationscribe.com. All rights reserved.

No Result
View All Result
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us

© 2024 automationscribe.com. All rights reserved.