Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Using Selected Date in Measure

Hi All,    I am looking to use a slicer to select a date in the future to view how many projects are categorized as "Done", "In Progress", or "Scheduled". My Current DAX looks like:   Status =  ...
  • v-yadongf-msft's avatar
    3 years ago

    Hi Anonymous ,

     

    This is my test table:

     

    Date table:

     

     

    Create a measure:

     

    Status = 
    VAR MINDate =
        MIN('Table'[Date])
    VAR MAXDate = 
        MAX('Table'[Date])
    RETURN
        SWITCH (
            TRUE (),
            MINDate <= MAX(timeline[Start Date])
                && MAXDate >= MAX(timeline[End Date]), "In Progress",
            MINDate >= MAX(timeline[Start Date])
                && MAXDate >= MAX(timeline[End Date]), "Done",
            "Scheduled"
        )

     

     

    Create a slicer form date table and create a table visual from timeline table:

     

     

     You can select a date in the future to view how many projects are categorized as "Done", "In Progress", or "Scheduled":

     

     

    Best regards,

    Yadong Fang

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