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

How to calculate YTD Savings from my table given below

Hello,

 

I am trying to calculate the YTD variance for my sample table shown below. 

Table Name is "Project Costs" 

 

Capture.PNG

 

I want to calculate YTD variance for this table

The formula is YTD variance = (Current month Variance) - (December month's variance of last year)

 

I used the below DAX calculation 

 

YTD_Variance = SUM('Project Costs'[Variance]) - CALCULATE(SUM('Project Costs'[Variance]), PREVIOUSMONTH('Date'[Date]))

 

This calculation works for January 2018 month, but for February 2018 it is showing wrong calculation as shown below.

 

Ca2pture.PNG

 

 

@Anonymous, you helped me last time, Please help me correct DAX calculation 

 

PS: I have the date dimension included. 

 

Thanks

Bhavesh

 

 

1 REPLY 1
Anonymous
Not applicable

Try this 

Measure_Name =

VAR Last_Dec_Varience =
CALCULATE( [Variance],
FILTER(ALL('Dim - Date'),
'Dim - Date'[Calendar Year] = YEAR(TODAY())-1 && 'Dim - Date'[Month Of Year] = 12)
)

RETURN

[Variance] - Last_Dec_Varience

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.