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
Giada90
Helper III
Helper III

calculation with aggregated and not aggregated fields

Hi,

I have an excel like this:

Giada90_0-1721649464208.png

 

 

I need to calcolate the margin for each person and I need to make sales - sum(costs), the result must me something like this:

 

Giada90_1-1721649483943.png

 

 

How can I calculate the margin?

Thanks

 

1 ACCEPTED SOLUTION

@Giada90 , I created calculated colmn using

 

TotalCost =
CALCULATE(
    SUM('Table'[Cost]),
    ALLEXCEPT('Table', 'Table'[Person])
)
 
And one for subtraction 
 
Margin = 'Table'[Sales]-'Table'[TotalCost]
 
Please find the attached PBIX



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

4 REPLIES 4
Giada90
Helper III
Helper III

@bhanu_gautam I tried like this 

Colonna = Foglio1[sales]-sum(Foglio1[cost])
 
but it doesn't work
Giada90_0-1721650283421.png

any suggestion?

thanks

@Giada90 , I created calculated colmn using

 

TotalCost =
CALCULATE(
    SUM('Table'[Cost]),
    ALLEXCEPT('Table', 'Table'[Person])
)
 
And one for subtraction 
 
Margin = 'Table'[Sales]-'Table'[TotalCost]
 
Please find the attached PBIX



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






thanks!!

bhanu_gautam
Super User
Super User

@Giada90 , Can you elaborate this , as of now it seems sales amount from sum of cost to get margin you can do this in Power Query creating new custom column or you can also do this at front end by creating a new calculated column




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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