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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ejzimmerman
Regular Visitor

Year over Year Cost Calculation

Hi,

 

For my report, I am trying to report out on the year over year cost increase, and my source data is in a similar format to the data shown in the table below. I am trying to create a measure that will return the cost for the prior year/month/day etc. that varies based on the table or chart. I've looked around the other posts on this topic, but I can't seem to get them to work. I show a sample dataset then what the output should look like when summing by year and supplier.

 

Sample Dataset:

DateMonthYearIdentifer 1SupplierCost
1/1/20211/1/202120211A120
1/2/20211/1/202120212A110
1/3/20211/1/202120213B100
1/4/20211/1/202120214B90
1/5/20211/1/202120215C80
1/6/20211/1/202120216C70
1/1/20201/1/202020201A60
1/2/20201/1/202020202A50
1/3/20201/1/202020203B40

 

Output:

YearSupplierCostPrior Year CostTrend
2021A230110120
2021B19040150
2021C1500150
2020A1100110
2020B40040
2020C000
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @ejzimmerman 

 

Try these measures :

Prior Year = 
VAR _LY =
    CALCULATE (
        SUM ( 'Table'[Cost] ),
        ALLEXCEPT ( 'Table', 'Table'[Supplier] ),
        PREVIOUSYEAR ( 'Table'[Date] )
    )
RETURN
    IF ( ISBLANK ( _LY ), 0, _LY )
Cost Trend = 
SUM ( 'Table'[Cost] ) - [Prior Year]

 

Output:

VahidDM_0-1631343405672.png

 

Download the sample file: https://gofile.io/d/EtW8Ls

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos 🙏!!

View solution in original post

2 REPLIES 2
ejzimmerman
Regular Visitor

Thank you! That solved my problem. Really appreciate the help.

VahidDM
Super User
Super User

Hi @ejzimmerman 

 

Try these measures :

Prior Year = 
VAR _LY =
    CALCULATE (
        SUM ( 'Table'[Cost] ),
        ALLEXCEPT ( 'Table', 'Table'[Supplier] ),
        PREVIOUSYEAR ( 'Table'[Date] )
    )
RETURN
    IF ( ISBLANK ( _LY ), 0, _LY )
Cost Trend = 
SUM ( 'Table'[Cost] ) - [Prior Year]

 

Output:

VahidDM_0-1631343405672.png

 

Download the sample file: https://gofile.io/d/EtW8Ls

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos 🙏!!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.