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
IBKA
New Member

Default date J-1 once we open the report all the DAX measures should be filtred at J-1 by default

Hi All,

I have the filtres Year/Month and date, and I have a lot of KPIS and I want to display them by default at J-1 once the user open the report or to be more specifique once no filtre is selected, in my model I have a fact table linked to a dim date.

any DAX formula to sugest please🏆?

I tried this example to show the number of Acqusition

 

 

yes/NO Slicer Selection = Var Select_Slicer = MAX('Dim DATE'[Date])-1

Return
IF(NOT(ISFILTERED('Dim DATE'[Date])),CALCULATE([All Acquisition],FILTER('Dim DATE','Dim DATE'[Date]= Select_Slicer)),[All Acquisition])

 

 

but it didn't work 

 

IBKA_0-1674832129745.png

 

 

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

Hi @IBKA ,

 

As far as I know, if you want to use ISFILTERED() function to check whether your slicer is selected in your code, the table with the column in that slicer should be unrelated to your data table. So please inactive or remove the relationship between your DimDate table and Data table.

Then update [All Acquisition] with some filter from DimDate table.

yes/NO Slicer Selection =
VAR Select_Range =
    VALUES ( 'Dim DATE'[Date] )
VAR Select_Slicer =
    MAX ( 'Dim DATE'[Date] ) - 1
VAR True_Result =
    CALCULATE (
        [All Acquisition],
        FILTER ( 'Fact Table', 'Fact Table'[Date] IN Select_Range )
    )
VAR False_Result =
    CALCULATE (
        [All Acquisition],
        FILTER ( 'Fact Table', 'Fact Table'[Date] = Select_Slicer )
    )
RETURN
    IF ( ISFILTERED ( 'Dim DATE'[Date] ), True_Result, False_Result )

 

Best Regards,
Rico Zhou

 

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

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @IBKA ,

 

As far as I know, if you want to use ISFILTERED() function to check whether your slicer is selected in your code, the table with the column in that slicer should be unrelated to your data table. So please inactive or remove the relationship between your DimDate table and Data table.

Then update [All Acquisition] with some filter from DimDate table.

yes/NO Slicer Selection =
VAR Select_Range =
    VALUES ( 'Dim DATE'[Date] )
VAR Select_Slicer =
    MAX ( 'Dim DATE'[Date] ) - 1
VAR True_Result =
    CALCULATE (
        [All Acquisition],
        FILTER ( 'Fact Table', 'Fact Table'[Date] IN Select_Range )
    )
VAR False_Result =
    CALCULATE (
        [All Acquisition],
        FILTER ( 'Fact Table', 'Fact Table'[Date] = Select_Slicer )
    )
RETURN
    IF ( ISFILTERED ( 'Dim DATE'[Date] ), True_Result, False_Result )

 

Best Regards,
Rico Zhou

 

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

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.