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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
v-xinruzhu-msft
Community Support
Community Support

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors