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
jkhan
Helper III
Helper III

YTD & LYTD is not working with Year Silicer

i am using below dax for YTD & LYTD

 

TS_YTD = TOTALYTD( SUM(PBI_FACT_UCAS_PO[ORDER_AMOUNT_SAR]),'date'[Date])
 
TS_LYTD = VAR DataMaxDate = CALCULATE ( MAX ( 'PBI_FACT_UCAS_PO'[ORDER_DATE] ), ALL ( PBI_FACT_UCAS_PO ) )
RETURN
CALCULATE ( [TS_YTD], SAMEPERIODLASTYEAR ( DATESBETWEEN ( 'date'[Date], BLANK (), DataMaxDate ) ) )
 
When I added Year Silicer and Selecting Particular Year, LYTD  Values are not getting changed
and also YTD is showing Sales for complete Year not upto JUNE month.
1.JPG2.JPG
4 REPLIES 4
jkhan
Helper III
Helper III

Please do help me to fix this issue. 


 

Hi @jkhan ,

What about this measure below?

LYTD = CALCULATE([YTD],DATEADD('Date'[Date],-1,YEAR))

Here is my test output.

Untitled.png

If you still need help, please share your data smaple and your desired output so that we could help further on it.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have modified my LTYD DAX to below

 

TS_YTD = TOTALYTD( SUM(PBI_FACT_UCAS_PO[ORDER_AMOUNT_SAR]),'date'[Date])

TS_LYTD = CALCULATE([TS_YTD],DATEADD('Date'[Date],-1,YEAR))

 

For 2019 YTD is working fine taking Date from JAN-2019 to JUN-2019

But LYTD is taking complete 2018 Year i.e. JAN-2018 to JUN-20181.JPG

 

For 2018 YTD is taking complete 2018 Year JAN-2018 to JUN-2018

And LYTD is taking complete 2017 Year i.e. JAN-2017 to JUN-2017

 

2.JPG

I want YTD  and LYTD to work from JAN to JUN for any year selected in Slicer

If you have DAX please do share with me, I am trying to achive above result from long time but no success.

 

Best Regards

Jamsher 

Thanks for Reply, I will test now and will share output. 

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.