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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
daircom
Resolver II
Resolver II

How to write dax to filter up to and including a date

Hi all,

 

I have the dataset below, which has an as_of_date (this is a snapshot date). So if 04/09/2024 is selected all data for this day shows up. I want to create a slicer which can filter the data in a way that I can select a single As_of_date, and that it selects all As_of_date up to and including the selected date. So if I select the As_of_date 05/09/2024 from the slicer, it should also show all the data from 05/09/2024, but also 04/09/2024 and 03/09/2024 etc.

In short: I want to select a single date in the slicer and it should filter all data up to and including that date.

daircom_0-1725547730566.png

 

 

2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@daircom,

 

Try a date slicer with Style "Before":

 

DataInsights_0-1725550639485.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Anonymous
Not applicable

Hi, @daircom 

Based on your information, I create a sample table:

vyohuamsft_0-1725589884303.png

Create another table:

vyohuamsft_1-1725589912661.png

 

Then create a new measure and try the following DAX expression:

 

FilteredDates = 
VAR _Slicer = MAX('Table 2'[As_of_date])
RETURN 
IF(MAX('Table'[As_of_date])>_Slicer,BLANK(),SUM('Table'[Volume of goods]))

 

Put this measure in table view, and put Table 2[As_of_data] in slicer.

Here is my preview:

vyohuamsft_3-1725590006161.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @daircom 

Based on your information, I create a sample table:

vyohuamsft_0-1725589884303.png

Create another table:

vyohuamsft_1-1725589912661.png

 

Then create a new measure and try the following DAX expression:

 

FilteredDates = 
VAR _Slicer = MAX('Table 2'[As_of_date])
RETURN 
IF(MAX('Table'[As_of_date])>_Slicer,BLANK(),SUM('Table'[Volume of goods]))

 

Put this measure in table view, and put Table 2[As_of_data] in slicer.

Here is my preview:

vyohuamsft_3-1725590006161.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DataInsights
Super User
Super User

@daircom,

 

Try a date slicer with Style "Before":

 

DataInsights_0-1725550639485.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.