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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
rh203
Helper I
Helper I

Calculated Column: Sum of another column from same table based on criteria

Hi,

 

I am trying to sum a value in a table to create a pallet projection based on a starting stock position, inbound and outbound volume.

 

All of this data is within the same table but when I try to use a calculate function to bring back a value within the same table based on a couple of conditions, the formula simply brings back the total value from the column I am summing, rather than the specific sum of only the row criteria (product code).

 

Difficult to explain but the intention is to create a pallt projectio at product level which I can then roll up to various levels of aggregation.

 

To cut a long story short, it needs to be done like this in a calculated column format as the projection itself needs to be worked out in PBI itself during each refresh)

 

Thanks for any help

 

rh203_0-1601375700899.png

 

 

1 ACCEPTED SOLUTION

OK, you're on your way.

You could improve it by amalgamating the two FILTER clauses into one.

 

FILTER(Pallet_projection, Pallet_projection[dateke...] = 0  && Pallet_projection[factor...] = EARLIER Pallet_projection[factor...]

 

 

I've just shortened my typing with .......

View solution in original post

3 REPLIES 3
HotChilli
Super User
Super User

I think we'll need more information.

It's a little difficult to decipher the picture posted because all the scoring out and zero values.

 

Are you trying to get the sum of the 'Pallet Count Latest' value for all the rows that have the same Datekey Index and Factory Code as the current row?

Hi, Thanks for the reply - yes sorry I had to redact for obvious reasons.

 

I worked out the solution in the last 15 mins - see below.

 

Looks like 'EARLIER' is key to pick up the current row as the criteria for a filter within the CALCULATE function.

 

It's done the job.

 

Thanks for your help 

 

 

rh203_0-1601382766556.png

 

OK, you're on your way.

You could improve it by amalgamating the two FILTER clauses into one.

 

FILTER(Pallet_projection, Pallet_projection[dateke...] = 0  && Pallet_projection[factor...] = EARLIER Pallet_projection[factor...]

 

 

I've just shortened my typing with .......

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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