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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

MTH/QTR/YTD Slicer Same Period Last Year

Hi All,

I have created a slicer for financial periods MTH,QTR,YTD 'Select Period' then I use it filter the columns. What is the DAX for equivalent last year, so same month last year, same qtr last year and last year?

 

< New Total GWP = CALCULATE(SUM('PA New Business'[GWP])) 

--Slicer wrapper around measure for current year

Slicer GWP = if(HASONEVALUE('Select Period'[Period]),
            SWITCH(VALUES('Select Period'[Period]),
            "MTH", CALCULATE([New Total GWP],DATESMTD('PA New Business'['Issue Date (Formatted)])),
            "QTR", CALCULATE([New Total GWP],DATESQTD(DATESMTD('PA New Business'['Issue Date (Formatted)]))),
            "YTD", CALCULATE([New Total GWP],DATESYTD(DATESMTD('PA New Business'['Issue Date (Formatted)])))),
            CALCULATE([New Total GWP],DATESMTD('PA New Business'['Issue Date (Formatted)]))) />

 

< LYTD GWP = CALCULATE([New Total GWP],SAMEPERIODLASTYEAR(DATESYTD('Date'[Date])))
LQTR Count = CALCULATE('_Measures'[New Bus Count],PREVIOUSQUARTER(DATESYTD('Date'[Date])))
--Slicer wrapper for Same period last years MTD/QTR/YR ??
Slicer LY GWP = if(HASONEVALUE('Select Period'[Period]),
            SWITCH(VALUES('Select Period'[Period]),
            "MTH", CALCULATE([New Total GWP],DATESMTD('PA New Business'['Issue Date (Formatted)])),
            "QTR", CALCULATE([New Total GWP],DATESQTD(DATESMTD('PA New Business'['Issue Date (Formatted)]))),
            "YTD", CALCULATE([New Total GWP],DATESYTD(DATESMTD('PA New Business'['Issue Date (Formatted)])))),
            CALCULATE([New Total GWP],DATESMTD('PA New Business'['Issue Date (Formatted)]))) />
 
Thanks for any help.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Let me quote: "But how do i format the DAX for equivalent last year..."

If you want to format your DAX, then you www.daxformatter.com.

Best
D

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Let me quote: "But how do i format the DAX for equivalent last year..."

If you want to format your DAX, then you www.daxformatter.com.

Best
D

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors