cancel
Showing results for 
Search instead for 
Did you mean: 
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
RicoZhou
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
RicoZhou
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
T-Shirt Design Challenge 2023

Power BI T-Shirt Design Challenge 2023

Submit your creative T-shirt design ideas starting March 7 through March 21, 2023.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors