avatarPBI Guy

Summary

The context provides a detailed guide on implementing Time Intelligence in Power BI using a disconnected table approach.

Abstract

The text discusses the importance of Time Intelligence in Power BI for navigating chronological data with agility and insight. It presents various methods to set up Time Intelligence, including Calculation Groups, DAX Time Intelligence Functions, Quick Measures, Custom Calendar Tables using Power Query, Relative Date Filtering, Time-Based Slicers, and the Disconnected Table approach. The focus is on the Disconnected Table approach, which is a quick and dirty method for setting up Time Intelligence in dashboards. The guide provides a step-by-step process involving adding a disconnected table to the data model, copying DAX measures, and adding the measure to the visual for control. The author emphasizes the simplicity and effectiveness of this method in delivering insights with a few clicks.

Opinions

  • The author expresses a preference for dashboards with Time Intelligence, suggesting they lose interest in those without it.
  • The author finds DAX Time Intelligence Functions useful for performing time-based calculations easily.
  • The author considers Quick Measures in Power BI beneficial for users less familiar with DAX, providing pre-defined calculations for time intelligence.
  • The author finds Custom Calendar Tables using Power Query more intuitive to build and requiring less knowledge of DAX.
  • The author appreciates the flexibility of Relative Date Filtering in Power BI for dynamically filtering data.
  • The author values Time-Based Slicers for allowing end-users to dynamically interact with the data and view it for different time frames.
  • The author finds the Disconnected Table approach a simple and effective method for setting up Time Intelligence in dashboards.

Time Intelligence Trick in Power BI

One of my favorite features in a Dashboard is the ability to travel in time seamlessly. When a data model lacks time intelligence, I tend to lose interest in the Dashboard.

Whether you are tracking sales growth, monitoring inventory levels, or predicting market trends, Time Intelligence in Power BI empowers you to navigate your chronological data with unparalleled agility and insight.

There are different ways to set up Time Intelligence in Power BI:

  • Calculation groups: I actually wrote an article about it:
  • DAX Time Intelligence Functions: DAX language includes a suite of time intelligence functions like TOTALYTD (Total Year-to-Date), SAMEPERIODLASTYEAR, DATEADD, and many more. These functions allow you to perform time-based calculations easily.
  • Quick Measures: For users less familiar with DAX, quick measures in Power BI provide pre-defined calculations, many of which are geared towards time intelligence, like calculating year-over-year change.
  • Custom Calendar Tables using Power Query: this is more intuitive to build and requires less knowledge of DAX.
  • Relative Date Filtering: Power BI allows you to filter data on your reports and dashboards dynamically using relative date filtering, such as the last N days, weeks, months, or years.
  • Time-Based Slicers: Incorporating slicers based on time periods (like years, quarters, months, days) allows end-users to dynamically interact with the data and view it for different time frames without altering the underlying reports.
  • Disconnected table: this approach has different strategies depending on how your data model has been built.

Disconnected table approach

In this article I will show you a trick that you can use to set up a quick and dirty time intelligence for your dashboards.

Step #1:

Add a disconnected table to your data model containing the Time bucket and an ID column based on the requirements of your dashboard. In this example we are going to create 4 measures only, but you can add as many as you need.

Image by Author

Step #2:

Copy the following DAX measure and add/remove the variables as per your requirements:

PeriodSelection = 
VAR _PeriodSelected = SELECTEDVALUE('Time Intelligence'[ID]) 
VAR _MTD = MAX(FactTable[Date]) IN DATESMTD(DateTable[Date]) //Month to Date
VAR _QTD = MAX(FactTable[Date]) IN DATESQTD(DateTable[Date]) //Quater to Date
VAR _CYTD = MAX(FactTable[Date]) IN DATESYTD(DateTable[Date],"12/31") //Calendar Year to Date. In case your fiscal year starts on Jan 1st
VAR _FYTD = MAX(FactTable[Date]) IN DATESYTD(DateTable[Date],"6/30")  //Calendar Year to Date. In case your fiscal year starts on Jul 1st

RETURN
INT(
    SWITCH(
    _PeriodSelected,
    1,_MTD,  
    2,_QTD,  
    3,_CYTD, 
    4, _FYTD 
        )
)

Step #3:

Add the measure from step #2 to the visual you want to control and default the output to 1.

Image by Author

The magic happens when you select of the items from the disconnected table. The entire result is wrapped in the INT function, which converts the boolean TRUE/FALSE values from the time period checks into integer 1 or 0. This is likely for easier use or interpretation in whatever context this measure is used.

In summary, PeriodSelection lets a user select a time period and then calculates whether the latest date in your data falls within that selected period, returning 1 if it does and 0 if it doesn't.

You can also add the measure to other visuals if needed.

Here is the end result:

Image by Author

Pretty Cool, huh? simple and delivers a lot of insights with a few clicks.

If you want to play around with this report, you can download it using this link.

I hope you enjoyed reading this article. Thanks for reading and happy dashboarding!

PBI Guy

[email protected]

www.ootconsulting.com

Power Bi
Time Intelligence
Dax
Dashboard
Recommended from ReadMedium