Forum Discussion

shishanki's avatar
shishanki
Regular Visitor
3 years ago
Solved

Setting default value for 'between' (start and end date) date slicer

I need a date slicer (between-mode) that selects the most recent 24 houra data by default... while still allowing end-users to pick any other period (for both start and end dates).

 

From what I've seen, this is impossible to accomplish in PowerBI. Is that true?

Please help

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi shishanki ,

     

    As far as I know, Power BI doesn't support us to set default date in slicer currently.

    Your demand is a good idea, while it is not supported to implement in Power BI currently.
    You can vote up this idea for this function:Set default date in slicer
    Or you can submit a new idea to improve the Power BI.
    It is a place for customers provide feedback about Microsoft Office products . What’s more, if a feedback is high voted there by other customers, it will be promising that Microsoft Product Team will take it into consideration when designing the next version in the future.

     

    There is a workaround to achieve your goal by unrelated DimDate table and measure. By this way, you need to create two unrelated date tables for rangestart and rangeend.

    My Sample:

    Data model:

    Measure:

    Filter M = 
    VAR _RANGESTART =
        SELECTEDVALUE ( RangeStart[Date] )
    VAR _RANGEEND =
        SELECTEDVALUE ( RangeEnd[Date] )
    VAR _CURRENTDATE =
        MAX ( 'Table'[Date] )
    RETURN
        IF (
            ISFILTERED ( RangeStart[Date] ) && ISFILTERED ( RangeEnd[Date] ),
            IF ( _CURRENTDATE >= _RANGESTART && _CURRENTDATE <= _RANGEEND, 1, 0 ),
            IF ( _CURRENTDATE = TODAY (), 1, 0 )
        )

    Add this measure into visual level filter and set it to show items when value =1.

     

    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.

2 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi shishanki ,

       

      As far as I know, Power BI doesn't support us to set default date in slicer currently.

      Your demand is a good idea, while it is not supported to implement in Power BI currently.
      You can vote up this idea for this function:Set default date in slicer
      Or you can submit a new idea to improve the Power BI.
      It is a place for customers provide feedback about Microsoft Office products . What’s more, if a feedback is high voted there by other customers, it will be promising that Microsoft Product Team will take it into consideration when designing the next version in the future.

       

      There is a workaround to achieve your goal by unrelated DimDate table and measure. By this way, you need to create two unrelated date tables for rangestart and rangeend.

      My Sample:

      Data model:

      Measure:

      Filter M = 
      VAR _RANGESTART =
          SELECTEDVALUE ( RangeStart[Date] )
      VAR _RANGEEND =
          SELECTEDVALUE ( RangeEnd[Date] )
      VAR _CURRENTDATE =
          MAX ( 'Table'[Date] )
      RETURN
          IF (
              ISFILTERED ( RangeStart[Date] ) && ISFILTERED ( RangeEnd[Date] ),
              IF ( _CURRENTDATE >= _RANGESTART && _CURRENTDATE <= _RANGEEND, 1, 0 ),
              IF ( _CURRENTDATE = TODAY (), 1, 0 )
          )

      Add this measure into visual level filter and set it to show items when value =1.

       

      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.