Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Default Date Values

Hi Power BI community! :),

this is my first post - So I have the following question: 

In my requirments I need the user to directly see the previous month in the dashboard. This means that I need to set a default value, which should always be the last month. I receive the dates from the DW in a granularity level of months, so I grouped my dates in my Time dimension into monthly bins. The user has a slicer on the dashboard, which allows him to switch between those bins. 

The relative slicer is also not an option, as the user should simply open the report, and not have to change anything with the filters. 

One way of doing it would be using the PREVIOUSMONTH function in combination with TODAY(), and filtering all the measures Via Calculate. But then I am not sure how they would behave if I want to slect a different month. Also I have a lot of KPIs.

Is there a way to solve this via Parameters? I wasn't able to fully wrap my head around the concept yet. Any ideas will be much appreciated.

Best regards,

Chris

  • hi, Anonymous

    You may try this way as below:

    Add a column for date column by this formula

    Column = IF( DATEDIFF('Date'[Date],TODAY(),MONTH)=1,"previous month")

    Then drag this field into a slicer or page level filter to filter the data.

     

    Best Regards,

    Lin

5 Replies

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi, Anonymous

    You may try this way as below:

    Add a column for date column by this formula

    Column = IF( DATEDIFF('Date'[Date],TODAY(),MONTH)=1,"previous month")

    Then drag this field into a slicer or page level filter to filter the data.

     

    Best Regards,

    Lin

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-lili6-msft,


      thanks for the valuable input, yes this seems to work nicely.
      One problem I am still facing though, is that if I want the user to have the ability to change the reporting period, this top level filter restricts the selection in the other slicers. If I put the Previous month filter on a visual level filter, the other slicers still don't seem to affect the selected visual. 

      Any ideas on how I could "bypass" the filter in case of a different selection?

      • v-lili6-msft's avatar
        v-lili6-msft
        Community Support

        hi, Anonymous

        Column = IF( DATEDIFF('Date'[Date],TODAY(),MONTH)=1,"previous month","not previous month")

        You could drag this field into a slicer do not drag it into visual\ page\ report  level filter to filter the data.

        If so when don't select any field or select all fields into slicer, they can change the reporting period optionally, and if only

        select "previous month", It will just previous month data.

         

        Best Regards,

        Lin