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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
alaynanich
Helper I
Helper I

Calculate YOY by ignoring the lowest granularity?

Hi PBI community,

 

So I have some sales data that comes in the below format. The Periods TY and LY means "This Year" and "Last Year", and I'm trying to find the YOY sales. The measure usually works but I think the transaction ID is confusing PBI and it's not calculating the difference. Is there any way to edit my DAX to ignore transaction id and get yoy for the skus? I only need transactions for distinct counts (my real data has a product hierarchy assoaciated with the sku so i need distinct counts and YOY sales for those too).

Sales YOY =
var ty = CALCULATE(SUM('Table'[sales]),'Table'[Period]="TY")
var ly = CALCULATE(SUM('Table'[sales]),'Table'[Period]="LY")
RETURN ty-ly
 

alaynanich_1-1716589219497.png

 

alaynanich_2-1716589244064.png

 

1 ACCEPTED SOLUTION
xifeng_L
Super User
Super User

Hi @alaynanich ,

 

You can refer to below column expression.

 

xifeng_L_0-1716610151962.png

 

But I think it would be more accurate to use a measure to calculate YOY instead of calculated column, since the calculated column is static.

 

xifeng_L_1-1716610178878.png

 

Sales YOY (Measure) = 
var ty = CALCULATE(SUM('Table'[sales]),'Table'[Period]="TY")
var ly = CALCULATE(SUM('Table'[sales]),'Table'[Period]="LY")
RETURN ty-ly

 

 

Demo - Calculate YOY by ignoring the lowest granularity.pbix

 

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

 

View solution in original post

3 REPLIES 3
xifeng_L
Super User
Super User

Hi @alaynanich ,

 

You can refer to below column expression.

 

xifeng_L_0-1716610151962.png

 

But I think it would be more accurate to use a measure to calculate YOY instead of calculated column, since the calculated column is static.

 

xifeng_L_1-1716610178878.png

 

Sales YOY (Measure) = 
var ty = CALCULATE(SUM('Table'[sales]),'Table'[Period]="TY")
var ly = CALCULATE(SUM('Table'[sales]),'Table'[Period]="LY")
RETURN ty-ly

 

 

Demo - Calculate YOY by ignoring the lowest granularity.pbix

 

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

 

Thank you! I think there was osmething wrong with my data model so now my original calculation is working, but appreciate your response!! Noted about the columns vs measures

alaynanich
Helper I
Helper I

can't seem to upload files so here's a copy of the sample data
PeriodMonthstore idtranssku #sales_typesalesunitsgpSales YOY

LYFEB18175181752023-02-24 00:00:0055115493640371online6.9911.56-6.99
LYFEB11577115772023-02-24 00:00:0057511251882562online220.04-2
LYFEB11577115772023-02-24 00:00:0057611113954383online110.02-1
TYFEB14296142962024-02-24 00:00:00460154152163714online19.9917.0819.99
LYFEB14296142962024-02-24 00:00:0026015525439984online39.98214.15-39.98
LYFEB15483154832023-02-12 00:00:0011212145584305retail27.9914.7-27.99
TYFEB17448174482024-02-26 00:00:005871113266496retail6.4911.546.49
LYFEB17749177492024-02-08 00:00:0015514361015587retail8.9913.04-8.99
TYFEB17749177492024-02-08 00:00:0015313094515587retail8.9913.048.99
TYFEB17353173532024-02-23 00:00:002047083325168retail25.1649.4925.16

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.