Forum Discussion

sgallo's avatar
sgallo
Icon for Advocate V rankAdvocate V
1 year ago
Solved

Changing Slicer values between Weeks and Months

Hi all,

 

I currently have my reports split in two, where I show by week and by month views. 

I tried to merge them into one using bookmarks and drilling through visuals. This resulted in having a "weekly" and "monthly" button selection that would change the view of the graphs accordingly. Below the example:

 

 

 

This worked for all the visuals apart from the Slicer on the top left of the screenshots that would not drill down/up nor allow a measure change.

Is there a way to have a slicer change between the week and month measures depending on bookmarks (or buttons or any other view)?

 

Thanks in advance

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, sgallo 

    Your solution using bookmarks is excellent; however, based on my understanding of your requirements, I would recommend using parameter fields instead.

    1.Firstly, here is my original data:

    2.Secondly, create a new column based on the original date column that spans weeks. Below is an example of my calculated column, which you can adjust according to your needs:

    weekly1 = WEEKNUM('Table'[Date])
    weekly = CALCULATE(MAX('Table'[Date]),FILTER('Table','Table'[weekly1]=EARLIER('Table'[weekly1])))
    

     

    3.Next, take the month hierarchy from the original date column and combine it with the newly created calculated column as parameter fields, renaming them accordingly.

    Parameter = {
        ("Weekly", NAMEOF('Table'[weekly]), 0),
        ("Monthly", NAMEOF('Table'[Date].[Month]), 1)
    }
    

    4.Then, modify the settings of the visual object:

    5.Following that, create two slicers, adjusting the settings for one of them:

     

    6.Here are the final results, which I hope will meet your needs:

    7.Here is the relevant documentation:

     Let report readers use field parameters to change visuals (preview) - Power BI | Microsoft Learn

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

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

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, sgallo 

    Your solution using bookmarks is excellent; however, based on my understanding of your requirements, I would recommend using parameter fields instead.

    1.Firstly, here is my original data:

    2.Secondly, create a new column based on the original date column that spans weeks. Below is an example of my calculated column, which you can adjust according to your needs:

    weekly1 = WEEKNUM('Table'[Date])
    weekly = CALCULATE(MAX('Table'[Date]),FILTER('Table','Table'[weekly1]=EARLIER('Table'[weekly1])))
    

     

    3.Next, take the month hierarchy from the original date column and combine it with the newly created calculated column as parameter fields, renaming them accordingly.

    Parameter = {
        ("Weekly", NAMEOF('Table'[weekly]), 0),
        ("Monthly", NAMEOF('Table'[Date].[Month]), 1)
    }
    

    4.Then, modify the settings of the visual object:

    5.Following that, create two slicers, adjusting the settings for one of them:

     

    6.Here are the final results, which I hope will meet your needs:

    7.Here is the relevant documentation:

     Let report readers use field parameters to change visuals (preview) - Power BI | Microsoft Learn

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

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