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
Anonymous
Not applicable

Creating YTD and Current Period Slicer

I'm looking to create a slicer for my dashboard that will allow me to switch from current period data (each year with it's total/year end data) to a YTD selection of the same data. The total crime chart below is an example of current year end period data. It's using a count from one table and the year coming from an "occured/entered date" collumn within that same table. 

KMont2_0-1647533872255.png

 

I am not familiar with how to set up a YTD measure using my date ranges and I noticed on other forums there was mention of creating a dates/calendar table, but I was unable to find an example of what that means and what data should be included so I'm hoping to get some examples to work from scratch with. 

 

The closest example of what I'm hoping to set up is similar to this (apologiez for the low quality): 

KMont2_1-1647534041455.png

(source: https://www.havensconsulting.net/blog-and-media/creating-a-mtd/qtd/ytd-time-intelligence-slicer)

 

My options, however would be YTD and Overall/Current Period. The YTD data would be referring to the folder/databases "modified last" date which I have in a separate table. 

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

Hi @Anonymous ,

 

To my understanding, you want to create a slicer with "YTD / QTD / MTD" to dynamically get the value .

Can you please share more details about your table and your expected output to help us clarify your scenario?

Below is a simply example:

Measure = 
SWITCH (
    MAX ( 'For Slicer'[Value] ),
    "YTD", CALCULATE ( SUM ( 'Table'[Value] ), DATESYTD ( 'Table'[Date] ) ),
    "QTD", CALCULATE ( SUM ( 'Table'[Value] ), DATESQTD ( 'Table'[Date] ) ),
    "MTD", CALCULATE ( SUM ( 'Table'[Value] ), DATESMTD ( 'Table'[Date] ) )
)

Eyelyn9_0-1648103162663.png

 

Best Regards,
Eyelyn Qin
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

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

To my understanding, you want to create a slicer with "YTD / QTD / MTD" to dynamically get the value .

Can you please share more details about your table and your expected output to help us clarify your scenario?

Below is a simply example:

Measure = 
SWITCH (
    MAX ( 'For Slicer'[Value] ),
    "YTD", CALCULATE ( SUM ( 'Table'[Value] ), DATESYTD ( 'Table'[Date] ) ),
    "QTD", CALCULATE ( SUM ( 'Table'[Value] ), DATESQTD ( 'Table'[Date] ) ),
    "MTD", CALCULATE ( SUM ( 'Table'[Value] ), DATESMTD ( 'Table'[Date] ) )
)

Eyelyn9_0-1648103162663.png

 

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

lbendlin
Super User
Super User

How is "Current Period"  different from YTD?

 

And yes, the recommendation is to use a calendar table that is fully covering your fact date range and any potential results from time intelligence functions like TOTALYTD, TOTALMTD etc.

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.