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
Anonymous
Not applicable

% Margin between rows

Hi!


I have searched for hours for this solution without success, please help me before I go mad. I have a set of data for all my projects. The data contains columns such as labour cost, material cost etc etc.

I wont to calculate the Sales and Production % margin for Project 1 and 2 and 3 and so on.

Is it possible to calculate rows with eachother?

 

Calculation           | Project       |    Labour cost |    Machining Cost    |    Material Cost   |

Sales Calc              Project 1         200 000            80 000                      300 000

Production Calc    Project 1         150 000             50 000                      400 000

Forecast Calc         Project 1         140 000             120 000                   250 000

4 REPLIES 4
Anonymous
Not applicable

Basically the difference between two values on the same column based on project number.

JBaker0585
Frequent Visitor

Is the graphic below an accurate representation of your data table? If so, you have a few options, but I would start by creating a MEASURE using SUMX and using that MEASURE in a CALCULATE function and use a FILTER to apply our measure to the Project you are working.

 

1. Total Sales := SUMX ( Table1, Table1[Labour cost] + Table1[Machining Cost] + Table1[Material Cost] )

2. Total Sales by Project :=

CALCULATE (

[Total Sales],

Table1[Project] = "Project 1"

)

 

I am not 100% what the Production % calculation needs to be, but I would assume (Labour cost + Machining Cost) / Total Sales, if so:

3. Production Cost := SUMX ( Table1, Table1[Labour cost] + Table1[Machining Cost] )

4. Production Percentage := DIVIDE ( [Production Cost], [Total Sales] )

 

5. Production % by Project :=

CALCULATE (

[Production Percentage],

Table1[Project] = "Project 1"

)

Anonymous
Not applicable

I guess I wasnt clear enough.

 

For each distinct project I want to do the following calculation.

 

(Sales Calculation of the labour cost -(minus) Forecast calculation of the labour cost) /(divided by) Sales calculation of the labour cost.

This will give me the sales margin and the same calculation goes for Production calculation.

 

 

 

 

 

Are the forecasted values stored in the same table snippet you originally showed? Can you share an actual slice of your data table and I can mock this up in Power Bi?

 

1. Labour Cost := SUMX ( Table1, [Labour Cost] )

2. Forecast Labour := SUMX ( Table1, [Forecast Labour] ) ** Unsure of your actual column name for forecasted labour

3. Sales Margin := DIVIDE ( [Labour Cost] - [Forecast Labour], [Labour Cost] )

4. If you are using the [Sales Margin] value in a visualization, you can apply this measure over a visual filtered by the 'Project' column. This would give you the total 'Sales Margin' for the Project 1, 2, 3, etc.

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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