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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Desarrollador9J
Frequent Visitor

EDATE AND SUMX doesn't work

Hi everybody

 

I am using the following measure to add the result of the calculation of a measure in several non-consecutive months:

 

SUMX(Dates,'Measures'[Measure])

 

This works perfectly. For example, when selecting 3 non-consecutive months ('01-01-2022', '02-01-2022',
05-01-2022) is adding the results given by the measure for each month.

 

But now I need it to show me the same sum, but for the equivalent of the months 1 year ago or 2 years ago.

For example, if I select ('01-01-2022', '02-01-2022','05-01-2022'), I would like you to add the result of the measurement calculated for '01-01-2021', '02-01-2021','05-01-2021'. For that I am using this measure:

 

SUMX(FILTER(Date,Date[Date]=EDATE((Date[Date]),-12)),'Measures'[Measure])

 

The problem with using functions like dateadd or parallelperiod is that they don't work with non-consecutive dates.

I would be very grateful to anyone who could help me.

 

LJ.

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Desarrollador9J,

 

Try this measure:

 

Last Year = 
CALCULATE ( SUM ( FactTable[Amount] ), SAMEPERIODLASTYEAR ( Dates[Date] ) )

 

The slicer and table visual use Dates columns:

 

DataInsights_0-1659540480353.png

Data:

 

DataInsights_1-1659540527971.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@Desarrollador9J,

 

Try this measure:

 

Last Year = 
CALCULATE ( SUM ( FactTable[Amount] ), SAMEPERIODLASTYEAR ( Dates[Date] ) )

 

The slicer and table visual use Dates columns:

 

DataInsights_0-1659540480353.png

Data:

 

DataInsights_1-1659540527971.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.