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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RemyBosman
Helper II
Helper II

Select latest date by default + possiblity to filter other dates

Hi all!  I'm struggling with a scenario which seemed simple to realize at first, but turns out to be not that simple. I have a report that should meet the following requirements

 

  • By default reports should be filtered on the latest date in my date table.
  • The user needs to be able to select any other date present in de date table.
  • When the user closes the reports and opens it back up tomorrow, it should be showing the latest date in the date table again.
  • I prefer to only make use of a date filter to make this work. Removing other filters like "IsToday" before beging able to select other dates are poor solutions in my opinion.

Any help and ideas are appreciated!

Regards, Remy

1 ACCEPTED SOLUTION

Hello, @RemyBosman

As a workaround, you can try to create a calendar table and then use the "ISFILTERED" function to create a "New Date" measure to replace the original "DATE" file:

New Date =
VAR default_date =
    TODAY () //LATEST DATE YOU WANT
RETURN
    IF (
        ISFILTERED ( 'Date'[Date] ),
        SUM ( 'Table'[Date] ),
        CALCULATE (
            SUM ( 'Table'[Date] ),
            FILTER ( 'Table', 'Table'[Date] = default_date )
        )
    )

When there is no selection in the date segmentation, the visuals will be filtered by the default date (today).

Once there is a selection in the slicer, the default value must be canceled and the visual should be filtered normally.

For more details, see the attached pbix file.

Best regards
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@RemyBosman , I think as of now the solution is like is today will work. You can have other dates in that

A new column like this

Is Today = if('Date'[Date]=max(Table[Date]),"Last Date",[Date]&"")

 

Sort it on date of your date table, so that user can select other dates too

@amitchandak 

Thanks for your response. A column like you mentioned wont work in a proper date picker am I right? Also when using this field in the standard filters pane theres no option to sort or use a date picker. 

2020-10-24 10_41_34-Dataset Achmea (MODEL II.I) Portefeuille & Performance (Sven) - Power BI.png

Hello, @RemyBosman

As a workaround, you can try to create a calendar table and then use the "ISFILTERED" function to create a "New Date" measure to replace the original "DATE" file:

New Date =
VAR default_date =
    TODAY () //LATEST DATE YOU WANT
RETURN
    IF (
        ISFILTERED ( 'Date'[Date] ),
        SUM ( 'Table'[Date] ),
        CALCULATE (
            SUM ( 'Table'[Date] ),
            FILTER ( 'Table', 'Table'[Date] = default_date )
        )
    )

When there is no selection in the date segmentation, the visuals will be filtered by the default date (today).

Once there is a selection in the slicer, the default value must be canceled and the visual should be filtered normally.

For more details, see the attached pbix file.

Best regards
Community Support Team _ Eason

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.