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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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