Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

R Script or Filter Dynamics for Date

Hi everyone, I wanted to ask if it was possible and how to create a dynamic command that checks the date and automatically sets a visual filter on it.

 

For example:

- today 01 January 2022, the filter removes the selection from 2021 and sets it on 2022 / Q1

 

 

- today's day 01 April 2022, adds 2022 / Q2 to the previous selection 2022 / Q1

 

 

Thanks

Alberto

  • Hi Anonymous ,

    The slicer can't automatically choose one value, but it can be filtered out.

    Create a measure.

    Check =
    IF (
        QUARTER (
            MAXX (
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Year Quarter] = SELECTEDVALUE ( 'Table'[Year Quarter] )
                ),
                'Table'[Date]
            )
        )
            = QUARTER ( TODAY () ),
        1,
        0
    )
    

    Put the measure in the visual filter, and select it to 1, the current quarter in the slicer will be filtered out.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

3 Replies

  • Anonymous , Can not default like that. You can create a column. That has all Qtr till date and default that

     

    New column in date table

     

    qtr Type =
    Switch( True(),
    [start qtr]<=Today()  && Year([Date]) = Year(Today()) ,"This Year Qtr " ,
    [qtr Name]
    )

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you for your reply, but that's not exactly what I'm looking for.

     

    What I would like is to be able to leave the entire calendar in the filter so that colleagues can vary the selection period, but when they open the report, the date automatically sets itself to the current year and adds up the quarters of that year. as in the second screen above instead of having to do it by hand every 3 months and save the bookmark.

     

    I had already thought about creating a new column with past and future and was selecting only the past days, but it didn't work.

     

    Thanks

  • Hi Anonymous ,

    The slicer can't automatically choose one value, but it can be filtered out.

    Create a measure.

    Check =
    IF (
        QUARTER (
            MAXX (
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Year Quarter] = SELECTEDVALUE ( 'Table'[Year Quarter] )
                ),
                'Table'[Date]
            )
        )
            = QUARTER ( TODAY () ),
        1,
        0
    )
    

    Put the measure in the visual filter, and select it to 1, the current quarter in the slicer will be filtered out.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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