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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
PeterHolland
New Member

How to Divide Two Filtered Calculated Sums

Hi there!

 

I'm trying to create a table which has the headers Sales in 2022, Sales in 2023, then the growth rate between the two, broken out by customer.

 

My source data looks like this:

CustomerProduct TypeSales 2022Sales 2023
AnnaMilk300400
JaneMilk100100
MarkMilk100200
AnnaBread300400
JaneBread1000
MarkBread200100

 

My desired end result would be this:

 

Customer

 

Total Sales, 2022

(sum of sales in 2022)

Total Sales, 2023

(sum of sales in 2023)

Percent Growth

(sum of sales in 2023/sum of sales in 2022)-1

Anna

60080033%
Jane200100-50%
Mark3003000%

 

I'm able to get the Total Sales, 2022 and Total Sales, 2023 columns no problem, but am having trouble with the Percent Growth column.

 

I tried several things, but I think the thing that was closest was this:

Percent Growth =
(CALCULATE(SUM('Table'[Sales 2023]),'Table'[Customer]=EARLIER('Table'[Customer]))
/
CALCULATE(SUM('Table'[Sales 2023]),'Table'[Customer]=EARLIER('Table'[Customer])))
-1
When I use the formula above, I get 0's for Anna and Mark and NaN for Jane
 
Any ideas how I might do this?
 
Thank you!
 
Peter

 

1 ACCEPTED SOLUTION
aj1973
Community Champion
Community Champion

Hi @PeterHolland 

Is this looking good?

aj1973_0-1667249733388.png

If yes simply add 2 measures for Sales 22 and 23 

Sales 22 = SUM(Sheet2[Sales 2022])
Sales 23 = SUM(Sheet2[Sales 2023])
Growth % = DIVIDE([Sales 23] - [Sales 22] , [Sales 22] , 0)

Then Use DIVIDE to have the growth

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

2 REPLIES 2
PeterHolland
New Member

Thank you so much! This worked. I have marked your solution as accepted!

 

I think I don't have a good understanding of how measures work 😄

aj1973
Community Champion
Community Champion

Hi @PeterHolland 

Is this looking good?

aj1973_0-1667249733388.png

If yes simply add 2 measures for Sales 22 and 23 

Sales 22 = SUM(Sheet2[Sales 2022])
Sales 23 = SUM(Sheet2[Sales 2023])
Growth % = DIVIDE([Sales 23] - [Sales 22] , [Sales 22] , 0)

Then Use DIVIDE to have the growth

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

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.