# Showing Month to Date (MTD) To Current Date In Power BI Using DAX

Showing month-to-date calculations to the current date (i.e. today) in Power BI is a common problem that I see all the time. The same goes with quarter- t- date and year-to-date. I’ve been asked this on the Enterprise DNA Support Forum quite a lot so it’s timely to create a tutorial around how to solve it. You may watch the full video of this tutorial at the bottom of this blog.

In this tutorial, I’m going to show how you can solve this quite easily using DAX formulas.

Many times when you showcase time comparison information, you want to show some results versus the previous month or the same month the previous year.

Historical information is usually projected for the entire month. The problem comes in when you might be in the middle of the month and you only want to show up to the current date.

So I’m going to show you how you can show the true like for like comparison. To illustrate this, I’m going to work with 20 days into the current quarter. In this example, we’re comparing to the first 20 days of the quarter last year.

## Time Comparison Using DAX

I’ve already got a few measures here so now we’re going to create quickly the quarter to date number. To do this, we click on New Measure and then write the formula in the formula bar.

We name this formula Sales QTD, and then use Time Intelligence functions. Using these functions are not too difficult. It’s just a matter of understanding which one to use. In this case, we are using the CALCULATE function.

We then grab it and put it inside the table, and we’ll see the results.

We can also put this into a chart, and we see that this is showing a quarter to date number. We use the date slicer as well and quickly change the time frame.

So for instance, we’re now in quarter 4 and we’re only going to have information up to the last twenty days because in this example it’s the 20th of October. To show that, we need to get our previous year’s numbers. First, we need to work out the previous year sales.

In this formula, we use the DATEADD, which is another Time Intelligence function. We’re comparing to the previous year, so we need to jump back a year here.

Since we wanted to go from sales previous year to sales previous year quarter to date, we simply need to replace the Total Sales inside our Sales QTD formula to previous year (Sales PY) to get our Sales PY QTD.

After which we drag it into our table and we can see the comparison of sales quarter to date (QTD) in the current context versus the prior year.

Now I’m going to show you what you probably have if you’re looking at live data. I’ll use this formula for our Total Sales to demonstrate it.

With IF logic, this is probably what you see in your data. You have sales quarter-to-date or it could be month-to-date or year-to-date, and then you’re looking at the entire number for the previous year.

We want to highlight only a certain period, so we need to implement some logic to enable us to do that.

## Showcasing True Time Comparisons

To show the true Power BI month-to-date, quarter-to-date, or year-to-date time comparisons, we need to get rid of or blank out the numbers that are past today or where they sit in the current context.

In the table below, we see that this is exactly today, 20th of October. We need to blank out this number if it’s greater than this date.

All we have to do is jump to our Sales PY QTD and wrap some IF logic around it like so.

This logic is saying, “if the last date is greater than today then make that equal to blank; if not then equal to the result”, and that’s going to do the work.

We see also the changes in the chart because the chart will not return blank values.

What’s great about this calculation is that it’s live, so as we go through time, the TODAY field is going to update and will give us the additional date or days worth of data every day.

## Conclusion

In this article, I take you through the exact steps to follow and some of the DAX formulas that you need to implement to show true Power BI month-to date, quarter-to-date, or year-to-date time comparisons. I used quarter to date (QTD) in the demonstration.

I ran through how you can effectively change your visualizations to illustrate the information in your Power BI reports in a compelling way. There’s plenty to learn around DAX formula visualization techniques.

With this blog tutorial, you will understand how to effectively manage time intelligence or time comparison-type information really well in all your Power BI reports.

All the best with this.

Sam

## Debugging DAX: Tips and Tools for Troubleshooting Your Formulas

One of the main reasons why businesses all over the world have fallen in love with Power BI is because...

## Practical Application of TREATAS Function in DAX

A hands-on project focused on using the TREATAS function to manipulate and analyze data in DAX.

## MAXX in Power BI – A Detailed Guide

A hands-on guide to implementing data analysis projects using DAX, focused on the MAXX function and its combinations with other essential DAX functions.

## Leveraging the COUNTX Function In Power BI

Learn how to leverage the COUNTX function in DAX for in-depth data analysis. This guide provides step-by-step instructions and practical examples.

## Using the FILTER Function in DAX – A Detailed Guide With Examples

A comprehensive guide to understanding and implementing the FILTER function in DAX, complete with examples and combinations with other functions.

## DATESINPERIOD Function in DAX – A Detailed Guide

Learn how to implement and utilize DAX functions effectively, with a focus on the DATESINPERIOD function.

## Using the DISTINCT Function Effectively in DAX

A systematic exploration of the DAX DISTINCT function to optimize data analytics.

## Guide and Many Examples – ALL Function in DAX

A detailed guide to understanding, implementing, and mastering the DAX ALL function, complemented by practical examples and combinatory techniques.

## Detailed Guide to SWITCH function in DAX

A comprehensive guide to mastering DAX functions in Power BI for conducting advanced data analysis.

## SUMMARIZE Function in DAX – A Deep Dive

A comprehensive guide to using the DAX function SUMMARIZE in Power BI, with detailed explanations and practical examples.

## Your Data Visualization Doesnâ€™t Look Great. What Should You Do?

Data visualization is the key to unlocking the insights hidden within your data. But, what if your...

## 5 Strategy Tips For Modern Data Management

Data is the lifeblood of modern business. It is the raw material that fuels everything from...