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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Dynamic slicer - how to build

Hi,

 

In my report I want to view MTD and YTD data percentages. They are already calculated. Each category MTD and YTD has subcategories Early, Late, On time and 'On time and early'. For each category and subcategory I want to have a slicer which filters the data. So one filter MTD/YTD and second filter early, late etc.

 

The second filter I already created with this measurement:

Measure Selection =
SWITCH( TRUE(),
VALUES(OTD_slicer_table_MTD[OTD_category_MTD]) = "On time and early" ,[MTD % On time or early],
VALUES(OTD_slicer_table_MTD[OTD_category_MTD]) = "On time",[MTD % On time],
VALUES(OTD_slicer_table_MTD[OTD_category_MTD]) = "Early",[MTD % Early],
VALUES(OTD_slicer_table_MTD[OTD_category_MTD]) = "Late",[MTD % Late],
BLANK())

 

Now I have this visual:

 

OTD_Inbound_Rev1 (UC) - Power BI Desktop_2019-01-29_11-49-09.png

 

So what I want is an extra slicer MTD / YTD so that the user can filter on MTD or YTD data (or even both if technically possible).

 

Can anyone advise please?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

you could do:

1) nested SWITCH - outer one would cover YTD/MTD, the inner is the one you have right now and its YTD equivalent

2) merge the 2 to have single switch with 2 slicers (one on 'Time Cut' and second one on 'OTD'):

Time CutOTDKey
YTDOn time and earlyYTD_OTAE
YTDOn timeYTD_OT
YTDEarlyYTD_E
YTDLateYTD_L
MTDOn time and earlyMTD_OTAE
MTDOn timeMTD_OT
MTDEarlyMTD_E
MTDLateMTD_L

 

Measure Selection =
SWITCH( UPPER(SELECTEDVALUE(Table[Key])),
"YTD_OTAE", [YTD % On time],
"YTD_OT". [YTD % On time],
"YTD_E", [YTD % Early],
"YTD_L", [YTD % Late],
"MTD_OTAE", [MTD % On time or early],
"MTD_OT". [MTD % On time],
"MTD_E", [MTD % Early],
"MTD_L", [MTD % Late],
BLANK()
)

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

1 REPLY 1
Stachu
Community Champion
Community Champion

you could do:

1) nested SWITCH - outer one would cover YTD/MTD, the inner is the one you have right now and its YTD equivalent

2) merge the 2 to have single switch with 2 slicers (one on 'Time Cut' and second one on 'OTD'):

Time CutOTDKey
YTDOn time and earlyYTD_OTAE
YTDOn timeYTD_OT
YTDEarlyYTD_E
YTDLateYTD_L
MTDOn time and earlyMTD_OTAE
MTDOn timeMTD_OT
MTDEarlyMTD_E
MTDLateMTD_L

 

Measure Selection =
SWITCH( UPPER(SELECTEDVALUE(Table[Key])),
"YTD_OTAE", [YTD % On time],
"YTD_OT". [YTD % On time],
"YTD_E", [YTD % Early],
"YTD_L", [YTD % Late],
"MTD_OTAE", [MTD % On time or early],
"MTD_OT". [MTD % On time],
"MTD_E", [MTD % Early],
"MTD_L", [MTD % Late],
BLANK()
)

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors