Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
thomaskelly
Helper I
Helper I

Date Measure Calculation

Good Morning

 

I have a table containing sales order information, each order has a due date for delivery.  I want to have a measure that counts the number of orders where the due date has passed the days current date otr today .  Eg if an order was due yesterday or last week it would be counted if the due date is before today.

 

I need a measure to calculate today , then to count the orders if then meant the criteria.

 

Help , or links would be most welcome

 

Can anyone help?

 

Many Thanks

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @thomaskelly,

You can use TODAY() function to return the current date. Or you can add a calendar table, and filter the order by comparing the date with the current date in calendar table. I try to reproduce your scenario using the following sample date, which displays the sales order information table.

 
1.png

Then create a measure using the formula below. Create a table, select the date in Calendar table, measure as Values level. You will get the expected result as the following screenshot. In the picture, you will get the count of order until the current date. For example, there are 6 orders’ due date passing 2016/11/20 in the first row, and there are 8 orders passing 2016/11/23 and so on.

 

Measure 2 = CALCULATE(COUNTA(Test3[Order]),FILTER(Test3,Test3[Due date]<MAX('Calendar'[Date])))


2.png


Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @thomaskelly,

You can use TODAY() function to return the current date. Or you can add a calendar table, and filter the order by comparing the date with the current date in calendar table. I try to reproduce your scenario using the following sample date, which displays the sales order information table.

 
1.png

Then create a measure using the formula below. Create a table, select the date in Calendar table, measure as Values level. You will get the expected result as the following screenshot. In the picture, you will get the count of order until the current date. For example, there are 6 orders’ due date passing 2016/11/20 in the first row, and there are 8 orders passing 2016/11/23 and so on.

 

Measure 2 = CALCULATE(COUNTA(Test3[Order]),FILTER(Test3,Test3[Due date]<MAX('Calendar'[Date])))


2.png


Best Regards,
Angelia

Thanks Angelia,

 

Works great Smiley Happy

 

Kind Regards

 

Thomas

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.