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
plddogs
Frequent Visitor

Prior Year YTD won't calculate

Hi guys,

 

Quick question on Prior Year YTD. I've been following the solved solutions on the prior threads but can't get my results to work.

 

I've created a separate contiguous date table (New Dates) to link to my General Ledger table "Date" column (The GL transactions table has multiple transactions for various dates) as one to many relationship. 

 

I've then written my YTD and prior YTD measures as such:

 

Net Amount = sum(GeneralLedger[Net Amount])

YTD Total = TOTALYTD([Net Amount],GeneralLedger[Date])

YTD Prior = CALCULATE([Net Amount], SAMEPERIODLASTYEAR('New Dates'[Date]))

This the the resulting table:

 

powerbi.png

 

Any ideas why this isn't working?

 

Much appreciated for the help!

1 ACCEPTED SOLUTION
Jack09
Frequent Visitor

Hi @plddogs

 

You can use below DAX for your Prior Year calculation:

 

Prior YTD: TOTALYTD([Net Amount], DATEADD(GeneralLedger[Date], -1, YEAR))

 

I think it'll works for you.

 

View solution in original post

5 REPLIES 5
Jack09
Frequent Visitor

Hi @plddogs

 

You can use below DAX for your Prior Year calculation:

 

Prior YTD: TOTALYTD([Net Amount], DATEADD(GeneralLedger[Date], -1, YEAR))

 

I think it'll works for you.

 

Figured it out. Thanks all!
Phil_Seamark
Employee
Employee

HI @plddogs

 

Please try this

 

YTD Prior = CALCULATE('GeneralLedger'[YTD Total], SAMEPERIODLASTYEAR('New Dates'[Date]))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Sorry, I m not sure I get that formula. Maybe you can help explain.

 

Is there suppose to be an expression after calculate? And also, GenearlLedger [YTD Total] is not set as a dimension at this point.

 

 

Hi @plddogs

 

It should just be referencing your calculated measure

 

YTD Prior = CALCULATE([YTD Total], SAMEPERIODLASTYEAR('New Dates'[Date]))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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.