Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Latest File Date by default whenever we open the report

Hi All,   I have max file date as 23 Nov 2019. I would like to display max file date as by default whenever we open the power BI report.   If i use relative date filter then it is displayin...
  • v-juanli-msft's avatar
    v-juanli-msft
    6 years ago

    Hi Anonymous 

    If whenever you open the file, the date slicer isn't selected, then you could create a measure as below:

    max date = MAX(Sheet6[date])
    
    max date's value =
    VAR maxfiledate =
        CALCULATE ( MAX ( Sheet6[date] ), ALL ( Sheet6 ) )
    VAR maxvalue1 =
        CALCULATE (
            SUM ( Sheet6[values] ),
            FILTER ( Sheet6, Sheet6[date] = maxfiledate )
        )
    VAR maxselected =
        CALCULATE ( MAX ( Sheet6[date] ), ALLSELECTED ( Sheet6 ) )
    VAR maxvalue2 =
        CALCULATE (
            SUM ( Sheet6[values] ),
            FILTER ( Sheet6, Sheet6[date] = maxselected )
        )
    RETURN
        IF ( ISFILTERED ( 'date'[Date] ), maxvalue2, maxvalue1 )
    

     

    If your case includes the scenario below:

    You open the file yesterday, change the date slicer to a centain date point, then close,

    Today, you open the file, its date slicer is filtered upon the file open.

    In this way, my measure doesn't work as expected.

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.