Forum Discussion

daircom's avatar
daircom
Icon for Resolver II rankResolver II
2 years ago
Solved

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 da...
  • DataInsights's avatar
    2 years ago

    daircom,

     

    Try a date slicer with Style "Before":

     

     

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, daircom 

    Based on your information, I create a sample table:

    Create another table:

     

    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:

     

    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.