Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Create 2 date slicers with same Date column

Hi!!

 

I would like to create 2 date slicers that are using the same Date column.

This is how i want it to work: 

 

First slicer: is showing the last 7 days, always visible.

Second slicer: is like a calendar, opened by button (using Bookmarks), contains the last 30 days.

 

My problem is the interaction between these 2 slicers, here is the scenario:

  1. when you open the dashboard, you select a date from first slicer (last 7 days), you get the result
  2. So now i want to select an old date ( last 30 days), so i open the Calendar, the First bookmark resets the 1st slicer, then i close the calendar to see the result. So far so good.
  3. Now i want to see other dates FROM THE 1ST SLICER (last 7 days), if i choose a date, now i have 2 dates selected, one from 1st slicer, and the other one from the 2nd, because the 2nd was not reset !! and that is my problem.

Any ideas how to fix this ? or can i do it another way ? 

 

Thank you in advance.

 

 
 
 
 
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    You can create a separate table.

     

    Then create the measure.

    Filter results = 
    SWITCH (
        SELECTEDVALUE ( 'Table (2)'[Slicer] ),
        "last 7 days",
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( 'Table', [Date] >= TODAY () - 6 && [Date] <= TODAY () )
            ),
        "last 30 days",
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( 'Table', [Date] >= TODAY () - 29 && [Date] <= TODAY () )
            )
    )

     

    You can check more details from here.

     

    Best Regards,

    Stephen Tao

     

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

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    You can create a separate table.

     

    Then create the measure.

    Filter results = 
    SWITCH (
        SELECTEDVALUE ( 'Table (2)'[Slicer] ),
        "last 7 days",
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( 'Table', [Date] >= TODAY () - 6 && [Date] <= TODAY () )
            ),
        "last 30 days",
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( 'Table', [Date] >= TODAY () - 29 && [Date] <= TODAY () )
            )
    )

     

    You can check more details from here.

     

    Best Regards,

    Stephen Tao

     

    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 Anonymous - can you please share your data model if it does not have any sensitive data? Thanks! 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Could you tell me if your problem has been solved?
    If it is, kindly Accept it as the solution. More people will benefit from it.
    Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


    Best Regards,
    Stephen Tao