Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

The slicer buttons should be dynamic.

I have period individual slicer button as below like 4W , 8W , 13W , 26W , 52W .. The ask is , these slicer buttons should be dynamic.  .i.e  Eg : If the forecast data is sent only for 13 weeks only 4, 8, 13 weeks should be shown ..it should not show 26W and 52W slicer buttons since we don't have the data . same as If the forecast data is sent only for 26 weeks only 4, 8, 13, 26 weeks should be shown , shoud not show 52W slicer button How can we achive this ? any help please? 
i have week slicer as below  and 

Bajigntrr_1-1722240663259.png

 

Bajigntrr_0-1722240639905.png

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Anonymous , Try using below method

Create a Table for Slicer Options: Create a table that contains all possible slicer options (e.g., 4W, 8W, 13W, 26W, 52W). This table will be used to dynamically filter the slicer options based on the available forecast data.

SlicerOptions
-------------
Period
4W
8W
13W
26W
52W

 

Create a Measure to Determine Available Periods

MaxPeriod =
VAR MaxWeeks = MAX('ForecastData'[Weeks])
RETURN
SWITCH(
TRUE(),
MaxWeeks >= 52, "52W",
MaxWeeks >= 26, "26W",
MaxWeeks >= 13, "13W",
MaxWeeks >= 8, "8W",
MaxWeeks >= 4, "4W",
BLANK()
)

 

Create a Calculated Column to Filter Slicer Options:

ShowPeriod =
VAR MaxPeriod = [MaxPeriod]
RETURN
SWITCH(
TRUE(),
'SlicerOptions'[Period] = "52W" && MaxPeriod = "52W", 1,
'SlicerOptions'[Period] = "26W" && (MaxPeriod = "52W" || MaxPeriod = "26W"), 1,
'SlicerOptions'[Period] = "13W" && (MaxPeriod = "52W" || MaxPeriod = "26W" || MaxPeriod = "13W"), 1,
'SlicerOptions'[Period] = "8W" && (MaxPeriod = "52W" || MaxPeriod = "26W" || MaxPeriod = "13W" || MaxPeriod = "8W"), 1,
'SlicerOptions'[Period] = "4W" && (MaxPeriod = "52W" || MaxPeriod = "26W" || MaxPeriod = "13W" || MaxPeriod = "8W" || MaxPeriod = "4W"), 1,
0
)

 

Add a slicer visual using the SlicerOptions table. Then, apply a visual-level filter to the slicer to only show periods where ShowPeriod is 1.

Add the Period field from the SlicerOptions table to the slicer visual.
In the Filters pane, add the ShowPeriod field to the visual-level filters and set it to show only values where ShowPeriod is 1.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@Anonymous , Try using below method

Create a Table for Slicer Options: Create a table that contains all possible slicer options (e.g., 4W, 8W, 13W, 26W, 52W). This table will be used to dynamically filter the slicer options based on the available forecast data.

SlicerOptions
-------------
Period
4W
8W
13W
26W
52W

 

Create a Measure to Determine Available Periods

MaxPeriod =
VAR MaxWeeks = MAX('ForecastData'[Weeks])
RETURN
SWITCH(
TRUE(),
MaxWeeks >= 52, "52W",
MaxWeeks >= 26, "26W",
MaxWeeks >= 13, "13W",
MaxWeeks >= 8, "8W",
MaxWeeks >= 4, "4W",
BLANK()
)

 

Create a Calculated Column to Filter Slicer Options:

ShowPeriod =
VAR MaxPeriod = [MaxPeriod]
RETURN
SWITCH(
TRUE(),
'SlicerOptions'[Period] = "52W" && MaxPeriod = "52W", 1,
'SlicerOptions'[Period] = "26W" && (MaxPeriod = "52W" || MaxPeriod = "26W"), 1,
'SlicerOptions'[Period] = "13W" && (MaxPeriod = "52W" || MaxPeriod = "26W" || MaxPeriod = "13W"), 1,
'SlicerOptions'[Period] = "8W" && (MaxPeriod = "52W" || MaxPeriod = "26W" || MaxPeriod = "13W" || MaxPeriod = "8W"), 1,
'SlicerOptions'[Period] = "4W" && (MaxPeriod = "52W" || MaxPeriod = "26W" || MaxPeriod = "13W" || MaxPeriod = "8W" || MaxPeriod = "4W"), 1,
0
)

 

Add a slicer visual using the SlicerOptions table. Then, apply a visual-level filter to the slicer to only show periods where ShowPeriod is 1.

Add the Period field from the SlicerOptions table to the slicer visual.
In the Filters pane, add the ShowPeriod field to the visual-level filters and set it to show only values where ShowPeriod is 1.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.