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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

DAX for YTD, LY YTD ,+/-,YTD LY%

Hi,

 

 I have a scenario where I have date and Total, I am supposed to calculate LY Total, LY +/-, LY%, YTD, YTD LY,+/- YTD, YTD LY% for every filter (date) selection in power BI.

Below is the excel attached with sample data.

Any help is highly appreciated.

Capture1.PNG

5 REPLIES 5
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

I am a bit confused about your sample data.
What is the "dimension" column used for?

Why the  the sample data contains two records with the same year_month(2020 january,2020 February,2020 March).

If possible, please show the original  data including last year's.

 

Best Regards,
Community Support Team _ Eason

amaleranda
Post Patron
Post Patron

Hi @Anonymous ,

 

I manged to get the list of measure you want to Please see below output. I created a data tabel and linked to data on one to many relationship with date in the fact tabel ( your tabel with totals).

for more info contact info@nykensanalytics.com.au

Answ1.PNG

 

Below are the respective measures.

====CURRENT TOTAL======

Current Total =
VAR Result =
SUM ( Sheet1[Total] )
RETURN
Result
 
===TOTAL LAST YEAR====
Total LY =
VAR Result =
CALCULATE (
[Current Total],
SAMEPERIODLASTYEAR ( 'Date'[Date] )
)
RETURN
Result
 
====VARIANCE LAST YEAR===
Variance LY =
VAR Result =
[Current Total] - [Total LY]

RETURN
Result
====% VARIANCE LAST YEAR==
% Variance LY =
VAR Result =
DIVIDE (
[Variance LY],
[Current Total]
)
RETURN
Result
 
==== TOTAL YEAR TO DATE==
Total YTD =
VAR Result =
TOTALYTD (
[Current Total],
'Date'[Date]
)
RETURN
Result
 
=====TOTAL YEAR TO DATE LAST YEAR==
Total YTD LY =
VAR Result =
CALCULATE([Total YTD],
SAMEPERIODLASTYEAR('Date'[Date]
)
)
RETURN
Result
======VARIANCE YTD LAST YEAR==
Variance YTD LY =
VAR Result =
[Total YTD] - [Total YTD LY]

RETURN
Result
====% VARIANCE YEAR TO DATE LAST YEAR===
% Variance YTD LY =
VAR Result =
DIVIDE (
[Variance YTD LY],
[Total YTD]
)
RETURN
Result
 

 

 

Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your Excel file which has the raw input.  Is your FY from January to Decemner?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi,

Thank you for the reply please share your mail id so that i can send you the file

Hi , @Anonymous 

For the protection of your data security, it is recommended to upload a simple demo to onedrive for business . Remember to not post any sensitive data while doing this. 

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.