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
Anonymous
Not applicable

How to create a measure with a filter between two dates

I got a quick question

I got for example the following range of dates 

afleiderman1_0-1676927554803.png

And I have a measure that is sum of sales.

I am wondering is there a way to create a measure that filter based on the date range the user choose in the slicer.

For example I want to return the sum of sales if the user chose between 8/21/2022 and 2/20/2023 or between

9/21/2022 and 1/1/2023 for example

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Cant you do this by adding the regular slicer available in powerbi? 

CalebR_0-1676927966302.png

Adding the slicer visual will automatically add filter context to your visual/measures. I just did a simple test here with my database, summing the amount of items ordered by item code. When you change the date range it automatically updates those sums to the total that is within that set date range. (In my case WODueDate_CC)

CalebR_1-1676928026691.png

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

I have date in my columns between those period but its like I am trying to calculate a grand total where you add all the dates between two periods. 

Anonymous
Not applicable

Hmmm I guess I am not understanding what you are going for then. Could you post an example set of data and the expected return? Also what is your current measure for summing the sales? 

Anonymous
Not applicable

Sure I can post like an excel type of example 

afleiderman1_0-1676929508471.png

I got something like this. My rows are the warehouses. My column are the dates for example 8/21 to 9/21 and I chose these two dates based on a date filter. My values is the total sales for that particular day. 

I would like a column that sums up the total sales between these two periods 8/21 to 9/3. But

I also have a date slicer and I would like the sum to change based on the dates chosen. 

Anonymous
Not applicable

Cant you do this by adding the regular slicer available in powerbi? 

CalebR_0-1676927966302.png

Adding the slicer visual will automatically add filter context to your visual/measures. I just did a simple test here with my database, summing the amount of items ordered by item code. When you change the date range it automatically updates those sums to the total that is within that set date range. (In my case WODueDate_CC)

CalebR_1-1676928026691.png

 

Anonymous
Not applicable

Ok now it makes sense to me, kind of new to power bi. thank you. 

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.