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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Samarth-Borade
Frequent Visitor

Get MTD for a selected date (create slicer with MTD , YTD and QTD)

If I select the date in date slicer 13/02/2023 then if i click on MTD option it will show me data in visuals from range 13/01/2023 to 13/02/2023, that is from selected date to the same date of previous month . Same for YTD . 

Can some one help me here ! 

basically i want two slicer one is Date slicer and other is selection slicer conatining MTD,YTD,QTD.

1 REPLY 1
Anonymous
Not applicable

Hi @Samarth-Borade 

You can creata a measure and use switch() function.

e.g 

 

SWITCH(TRUE(),MAX([Type])="MTD",CALCULATE(..,DATESMTD(DateTime[DateKey])),MAX([Type])="YTD",CALCULATE(..,DATESYTD(DateTime[DateKey])),MAX([Type])="QTD",CALCULATE(...,DATESQTD(DateTime[DateKey]))

 

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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