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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
RingoSun
Helper II
Helper II

Dynamic slicer based on another slicer

Let's say I have two slicers. The first slicer consists of Month Names and the other slicer will contain "Weekly", "Monthly", "Yearly".

 

So if I select only one month in the month names slicer, the other slicer should only show me the Weekly option

RingoSun_0-1656902910566.png

And if I have 4 months selected in the months slicer then the other slicer should show Weekly and Monthly 

RingoSun_1-1656903100813.png

That's basically the whole idea, is something like this actually possible in Power bi?

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @RingoSun ,

Here are the steps you can follow:

1. Create measure.

Flag =
SWITCH(
    TRUE(),
COUNTROWS(VALUES('Table'[Monthyear]))=1&&SELECTEDVALUE('Table2'[Slicer])="Week",1,
COUNTROWS(VALUES('Table'[Monthyear]))>=4&& OR( SELECTEDVALUE('Table2'[Slicer])="Month",SELECTEDVALUE('Table2'[Slicer])="Week"),1,
COUNTROWS(VALUES('Table'[Monthyear]))>=2&&SELECTEDVALUE('Table2'[Slicer])="Month",1,
0)

2. Result:

vyangliumsft_0-1657615613520.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @RingoSun ,

Here are the steps you can follow:

1. Create measure.

Flag =
SWITCH(
    TRUE(),
COUNTROWS(VALUES('Table'[Monthyear]))=1&&SELECTEDVALUE('Table2'[Slicer])="Week",1,
COUNTROWS(VALUES('Table'[Monthyear]))>=4&& OR( SELECTEDVALUE('Table2'[Slicer])="Month",SELECTEDVALUE('Table2'[Slicer])="Week"),1,
COUNTROWS(VALUES('Table'[Monthyear]))>=2&&SELECTEDVALUE('Table2'[Slicer])="Month",1,
0)

2. Result:

vyangliumsft_0-1657615613520.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

v-yangliu-msft
Community Support
Community Support

Hi  @RingoSun ,

I created some data:

Table:

vyangliumsft_0-1657078250104.png

Table2:

vyangliumsft_1-1657078250105.png

Here are the steps you can follow:

1. Create measure.

Flag=
SWITCH(
    TRUE(),
COUNTROWS(VALUES('Table'[Monthyear]))=1&&SELECTEDVALUE('Table2'[Slicer])="Week",1,
COUNTROWS(VALUES('Table'[Monthyear]))>=2&&SELECTEDVALUE('Table2'[Slicer])="Month",1,
0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1657078250105.png

3. Result:

Choose one:

vyangliumsft_3-1657078250106.png

Choose four:

vyangliumsft_4-1657078250107.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

@v-yangliu-msft 

Hi there, what changes can I make here to make it so that if I have four months selected, it would show both Week and Month

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors