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

Cost Per Unit Variances

 

I want show the unit cost variance from one month to the next - but if there is a blank month I want it to skip that month and go to the next...Ex: the 2nd item on the list - I want it to show the variance from Feb to Mar, Mar to Apr, Apr to July, July to Sep, etc. Can someone please help me?

TOTAL COST PER UNIT.PNG

 

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

I don't know how to calculate the cost. But you can change it yourself. Please download the demo in the attachment.

Measure 3 =
VAR lastMonth =
    CALCULATE (
        MONTH ( MAX ( 'Table1'[Period] ) ),
        FILTER ( ALL ( 'Calendar'[Date] ), 'Calendar'[Date] < MIN ( 'Calendar'[Date] ) )
    )
VAR costLastMonth =
    CALCULATE (
        DIVIDE (
            SUMX (
                'Table1',
                'Table1'[Burden Actual Cost] + 'Table1'[Labor Actual Cost]
                    + 'Table1'[Labor Var Inventory Value]
                    + Table1[Mtl Actual Cost]
            ),
            SUM ( Table1[Qty] )
        ),
        FILTER ( ALL ( 'Calendar'[Date] ), MONTH ( 'Calendar'[Date] ) = lastMonth )
    )
VAR costThisMonth =
    DIVIDE (
        SUMX (
            'Table1',
            'Table1'[Burden Actual Cost] + 'Table1'[Labor Actual Cost]
                + 'Table1'[Labor Var Inventory Value]
                + Table1[Mtl Actual Cost]
        ),
        SUM ( Table1[Qty] )
    )
RETURN
    IF ( ISBLANK ( costThisMonth ), BLANK (), costThisMonth - costLastMonth )

Cost-Per-Unit-Variances

 

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Can you share a sample of the original data, please?

 

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Here's an example of the original data

PeriodPartQtyBurden Actual CostLabor Actual CostLabor Var Inventory ValueMtl Actual Cost
3/31/171024609948                     1,241.10                       74.18                                      (67.68)              2,376.04
2/28/171024609960                     1,241.10                       74.18                                      (84.60)              2,616.23
2/28/171024609996                     4,451.41                     266.07                                    (135.36)              4,755.90
4/30/1710246099240                     6,224.41                     372.04                                    (338.40)           11,422.99
7/31/1710246099204                     4,833.00                     264.94                                    (320.28)              9,348.57
9/30/171024609984                     2,404.90                     150.63                                    (131.88)              3,975.00
10/31/1710246099204                     5,090.76                     279.07                                    (320.28)              9,371.75
11/30/1710246099132                     4,124.16                     226.09                                    (207.24)              6,529.27

Hi @Anonymous,

 

I don't know how to calculate the cost. But you can change it yourself. Please download the demo in the attachment.

Measure 3 =
VAR lastMonth =
    CALCULATE (
        MONTH ( MAX ( 'Table1'[Period] ) ),
        FILTER ( ALL ( 'Calendar'[Date] ), 'Calendar'[Date] < MIN ( 'Calendar'[Date] ) )
    )
VAR costLastMonth =
    CALCULATE (
        DIVIDE (
            SUMX (
                'Table1',
                'Table1'[Burden Actual Cost] + 'Table1'[Labor Actual Cost]
                    + 'Table1'[Labor Var Inventory Value]
                    + Table1[Mtl Actual Cost]
            ),
            SUM ( Table1[Qty] )
        ),
        FILTER ( ALL ( 'Calendar'[Date] ), MONTH ( 'Calendar'[Date] ) = lastMonth )
    )
VAR costThisMonth =
    DIVIDE (
        SUMX (
            'Table1',
            'Table1'[Burden Actual Cost] + 'Table1'[Labor Actual Cost]
                + 'Table1'[Labor Var Inventory Value]
                + Table1[Mtl Actual Cost]
        ),
        SUM ( Table1[Qty] )
    )
RETURN
    IF ( ISBLANK ( costThisMonth ), BLANK (), costThisMonth - costLastMonth )

Cost-Per-Unit-Variances

 

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.