Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

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

 

Schermata 2022-04-14 alle 08.53.54.png

 

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

 

Schermata 2022-04-14 alle 09.17.46.png

 

Thanks

Alberto

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

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.

vkalyjmsft_0-1650952276976.png

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.

View solution in original post

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

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.

vkalyjmsft_0-1650952276976.png

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.

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

amitchandak
Super User
Super User

@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]
)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.