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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Sebastian
Advocate III
Advocate III

Compare values in date areas

Hi all,

 

I try to find a way to compare the value from this year (01.01.2016 until today() ) and the same period last year (01.01.2015 until today() -1year)

 

The function sameperiodlastyear doesn't worked for this, I think.

Could someone give an advice which function i have to use?

 

Thanks.

1 ACCEPTED SOLUTION

Now I have create a measure which calculate the result i want 🙂

 

 

 

Previous Year =

CALCULATE(sum(BELEGP[RNetto]);
DATEADD(
FILTER(DATESYTD(Kalender[Date]);
Kalender[Date]<=
LASTDATE(Kalender[Date])
);
-1;YEAR
)
)

 

 

Thanks for your help 🙂

View solution in original post

3 REPLIES 3
Thiyags
Helper II
Helper II

@SebastianYou can use TOTALYTD function and SAMEPERIODLASTYEAR functions.

 

Create a measure SalesYTD using the following DAX

 

SalesYTD = TOTALYTD(SUM(Sheet1[Sales]),Sheet1[Date ].[Date],ALL(Sheet1[Product Category]),"12/31")

 

Create another measue SalesLYTD using the following DAX

 

LYTD = CALCULATE([SalesYTD],SAMEPERIODLASTYEAR(Sheet1[Date ].[Date]))

 

Then pull both the measures into the Clusted Column Chart

hm, i tryed it but the result is wrong.

 

I tryed the following measure:

 

Total = Calculate(sum(table[value]);Year(Document[date])=Year(today())-1;Format(Document[date];"DD.MM")<=Format(today();"DD.MM"))

 

The result is also wrong. But I don't know why. In my opinion the measure should sum the whole value in 2015 which is between 01.01.2015 and today - 1year (23.11.2015)

 

Could someone explain why the measure didn't work this way?

Now I have create a measure which calculate the result i want 🙂

 

 

 

Previous Year =

CALCULATE(sum(BELEGP[RNetto]);
DATEADD(
FILTER(DATESYTD(Kalender[Date]);
Kalender[Date]<=
LASTDATE(Kalender[Date])
);
-1;YEAR
)
)

 

 

Thanks for your help 🙂

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors