Calculate Consecutive Weekday & Weekend Days In Power BI Using DAX

No comments

We’re going to work through something really unique around Time Intelligence inside of Power BI.

This scenario was brought up on the Enterprise DNA Support Forum, where there was a need to compare “like-for-like” within months.

In other words, they wanted to compare the first working day in a particular month to the first working day in another month. It could extend to last month, last quarter, or last year, and so on.

This isn’t actually possible with standard time intelligence functions inside of Power BI. So we have to create some additional logic, and it’s quite advanced logic to actually work this out.

In this particular case, I’ve utilized the RANKX function to find these results and run this particular logic.

What we can then do is select any timeframe, any date, any year, any month, and actually see what number day are we in for either weekdays or weekends.

This enables us to feed this particular calculation into other functions and DAX measures to run time related logic from a more like-for-like basis.

This is some really powerful stuff and I’ve dived into all the key concepts in-depth in this tutorial. If you are completing this sort of analysis then I highly recommend that you dive into the video and look to understand and utilize this logic within your own Power BI models.

Enjoy!

Sam

***** Learning Power BI? *****
FREE COURSE – Ultimate Beginners Guide To Power BI
FREE COURSE – Ultimate Beginners Guide To DAX
FREE – Power BI Resources
Enterprise DNA Membership
Enterprise DNA Online

 

***Learn more about Enterprise DNA Membership***membership banner 3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s