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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors