Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Dynamic date filter based in other filter

Hello,

I have a table with project name and update column (date type). It is supposed that all records have similar week update, however, there are some records with an older week update.

I have a page with two filters which shows the report for each project. So first filter is project name and second filter is week.

I want a dynamic filter for week: when I select the project name, I want that the week filter automatically shows (by default) the last week update for this project.

 

Project NameUpdateWeek
Project A05-06-202024
Project A12-06-202025
Project A19-06-202026
Project B05-06-202024
Project B15-06-202025
Project B19-06-202026
Project C12-06-202025
Project C19-06-202026
Project D05-06-202024
Project D12-06-202025

 

In this example, when I select Project A, week filter should be by defaut week 26 (and optional weeks 24 ans 25). And if I select Project D, week filter should be by defauld week 25 (and optional week 24).

 

Thanks!

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous,

    Maybe you can create a measure to extract the last week based on current project group and compare it with the current date to return tag, then you can see this on your filter to filter records.

    Measure filter =
    VAR currDate =
        MAX ( Table[Week] )
    VAR _lastDate =
        CALCULATE (
            MAX ( Table[Week] ),
            ALLSELECTED ( Table ),
            VALUES ( Table[Project Name] )
        )
    RETURN
        IF ( curDate = _lastDate, "Y", "N" )
    

    Regards,

    Xiaoxin Sheng

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Do you know a way to clean the week filter each time when when I select a project in the project filter?
      Therefore, it will force that the user select a week, preventing mistakes.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    Maybe you can create a measure to extract the last week based on current project group and compare it with the current date to return tag, then you can see this on your filter to filter records.

    Measure filter =
    VAR currDate =
        MAX ( Table[Week] )
    VAR _lastDate =
        CALCULATE (
            MAX ( Table[Week] ),
            ALLSELECTED ( Table ),
            VALUES ( Table[Project Name] )
        )
    RETURN
        IF ( curDate = _lastDate, "Y", "N" )
    

    Regards,

    Xiaoxin Sheng