Forum Discussion

pearlyred's avatar
pearlyred
New Member
3 years ago

Grouping by date category using slicer date

Hi all,

 

I have a data table that includes these columns:

NameDue DateCompleted Date


I also have a calendar table ('Calendar Lookup') that feeds a single-select slicer with the month-end date.

I want to show a status based on the difference of Due Date and Slicer Date. I believe because I'm using the slicer date and not a static date, that I can't do anything with a DAX column and must use a measure.

 

I've created a grouping table ('Grouping Lookup'):

 

And I'm currently using this measure to determine the status:

 

Due Status = 
VAR Overdue =
    CALCULATE(
        [Total items],
            DATEDIFF('Data Table'[Due Date], MAX('Calendar Lookup'[Date]), DAY) > 0
    )
VAR DueSoon =
    CALCULATE(
        [Total items],
            DATEDIFF('Data Table'[Due Date], MAX('Calendar Lookup'[Date]), DAY) > -7 &&
            DATEDIFF('Data Table'[Due Date], MAX('Calendar Lookup'[Date]), DAY) <= 0
    )
VAR OnTrack =
    CALCULATE(
        [Total items],
            DATEDIFF('Data Table'[Due Date], MAX('Calendar Lookup'[Date]), DAY) <= -7
    )
RETURN
SWITCH(
    TRUE(),
    MAX('Grouping Lookup'[Order]) = 3,
    Overdue,
    MAX('Grouping Lookup'[Order]) = 2,
    DueSoon,
    OnTrack
)

 

 

This seems to work ok, but the downside is, selecting any of the statuses in that visualisation, doesn't filter the other page visualisations.

 

Is there a way to rework how I've done this so that the filters apply across visualisations on the page?

 

thanks!

1 Reply

  • selecting any of the statuses in that visualisation, doesn't filter the other page visualisations

    That is correct, you cannot impact the data model with a measure.  However, you can use measures as visual filters, and you can create a disconnected table with all the possible values for that measure. This combination will then allow you to "show everythign that is on track"  etc.