Forum Discussion

tebtim19's avatar
tebtim19
Helper IV
1 year ago

previous and nextday button

Hi is there anyone here know how to create a previous and next day button in power bi? 

I have a date column with the format dd/mm/yyyy. In my power bi visual I'm currently using the date filter, but I would like also to add Previous and next button so when I click next day the filter date and data will change for the next day, same procedure with previous button.

 

 

 

 

4 Replies

  • Hi! For this you can use a button then assign it actions to go to another page or bookmark. If you have it take you to another page, you could have the page for today set to today's date. The page or bookmark for previous would have a relative date filter of is in the last 1 day:

    For next (i.e. tomorrow) if would be is in the next 1 day:

     

    • tebtim19's avatar
      tebtim19
      Helper IV

      Hi audreygerred thanks for this information. Unfortunately this filter will only base in the windows date. It will not work if for example I have opened a data and filter it with 31.12.2024 and then when I click previous date it should goes back to the date 30.12.2024 and then when I click it it will goes to 29.12.2024 same when I click next it will change to date forward.


       

       
      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi,

        Thanks for the solution audreygerred  offered, and i want to offer some more information for user to refer to.

        hello tebtim19 , based on your descriotion, it cannot set the button directly, you can consider to alternative solution, you can refer to the following solution.

        Create two tables

        Table 2 = {"Previous","Next"}
        Table 3 = GENERATESERIES(1,100,1)

        Then create a measure

        MEASURE =
        SWITCH (
            SELECTEDVALUE ( 'Table 2'[Value] ),
            "Previous", MAX ( 'Table'[Date] ) - SELECTEDVALUE ( 'Table 3'[Value] ),
            "Next", MAX ( 'Table'[Date] ) + SELECTEDVALUE ( 'Table 3'[Value] )
        )
        

        Then create two slicers, and put the value of table2 and table3 to them.

        Output

         

         

        Best Regards!

        Yolo Zhu

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

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi tebtim19 

    Did the solution audreygerred  offered help you slove the problem, if it helps, you can consider to accept it as a solution so that more user can refer to. or if you have other problem, you can provide some information so that can provide more suggestion for you.

     

    Best Regards!

    Yolo Zhu