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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
aggarwal25
Frequent Visitor

Sum column values based on another column

Hi All

 

I have some data and I want to sum 'Translated Ampount' based on 'revenue Category' column and then be able to map it with the customer. PLease let me know how can I do that. Apprecaite any help.2017-08-17_15-34-11.png

 

 Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @aggarwal25,

 

You can take a look at below formulas if it suitable for your requirement:

 

Calculate column:

 

Sum Group = CALCULATE(SUM('Table'[Translated Ampount]),FILTER(ALL('Table'),[Revenue Catagory]=EARLIER('Table'[Revenue Catagory])) )

 

 

Measure:

 

Sum group 2 =
var catagory=LASTNONBLANK('Table'[Revenue Catagory],[Revenue Catagory])
return
CALCULATE(SUM('Table'[Translated Ampount]),FILTER(ALL('Table'),[Revenue Catagory]=catagory))

 

 

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Neftali
New Member

Neftali_0-1659543183330.png

Hi all

 

I have this data and I want to sum "Total Qty Per Request" based on the "Material Name." So I want the sum of the "Total Qty Per Request" for "Bot Bev G5," "Dexron LS Gear Oil 75W-90," etc. How would I be able to make a measure for this?

I have the same question about how to sum a column based on another column and cannot get a solution using the result provided. The "EARLIER" command isn't understood in my expression. Got any tips?

Anonymous
Not applicable

HI @aggarwal25,

 

You can take a look at below formulas if it suitable for your requirement:

 

Calculate column:

 

Sum Group = CALCULATE(SUM('Table'[Translated Ampount]),FILTER(ALL('Table'),[Revenue Catagory]=EARLIER('Table'[Revenue Catagory])) )

 

 

Measure:

 

Sum group 2 =
var catagory=LASTNONBLANK('Table'[Revenue Catagory],[Revenue Catagory])
return
CALCULATE(SUM('Table'[Translated Ampount]),FILTER(ALL('Table'),[Revenue Catagory]=catagory))

 

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

@Hi @aggarwal2,

 

Is there a customer in this table or is there a related table that contains customer? If this is the case you can easily drag and drop customer, translated amount an revenue category onto the Power BI desktop canvas and it works. Also you could create several measures that sum the different revenue categories like:

 

Consulting Revenue =
SUMX (
    FILTER ( Table1; Table1[Revenue Category] = "Consulting" );
    Table1[Translated Amount]
)

If there is no customer table related to this table or no customer in this table, how would you assign a part of the Translated amount to a customer? So what is the distribution key?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.