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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Difference of dimensions between measures

Capture.PNG

Hi All, 

 

I have calculated two measures gross margin and profit margin as above. 

 

I have a dimension in my data set "actual" and "plan". I am able to place the actual and plan in the column but i am unsure of how to put a variance (actual - plan) into the column beside "plan". Is there a way to do this? 

 

Thanks for your help

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

You need to create 3 measures as below:

 

Gross Margin = CALCULATE(MIN('Table'[Value]),ALLEXCEPT('Table','Table'[Category]))
Profit = CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Table','Table'[Category]))
result = 
VAR actual =
    CALCULATE (
        SWITCH (
            SELECTEDVALUE ( 'Table (2)'[row] ),
            "Gross Margin", 'Table'[Gross Margin],
            "Profit", 'Table'[Profit]
        ),
        'Table'[Category] = "actual"
    )
VAR plan =
    CALCULATE (
        SWITCH (
            SELECTEDVALUE ( 'Table (2)'[row] ),
            "Gross Margin", 'Table'[Gross Margin],
            "Profit", 'Table'[Profit]
        ),
        'Table'[Category] = "plan"
    )
RETURN
    SWITCH (
        SELECTEDVALUE ( 'Column'[Column] ),
        "actual", actual,
        "plan", plan,
        plan - actual
    )

and another 2 tables showed as below:

Table    ColumnTable ColumnTable       Table(2)Table Table(2)

Finally you will see:

 

1123.png

 

For the related .pbix file,pls click here.

 

Best Regards,

Kelly

 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

How you create the current view.  Can you share calculations.

Anonymous
Not applicable

Capture.PNG

 

 

So gross profit is calculated as profit/revenue and gross margin is cost/revenue. The version is a column in my dataset containing "actual" and "plan".  

Hi @Anonymous ,

 

You need to create 3 measures as below:

 

Gross Margin = CALCULATE(MIN('Table'[Value]),ALLEXCEPT('Table','Table'[Category]))
Profit = CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Table','Table'[Category]))
result = 
VAR actual =
    CALCULATE (
        SWITCH (
            SELECTEDVALUE ( 'Table (2)'[row] ),
            "Gross Margin", 'Table'[Gross Margin],
            "Profit", 'Table'[Profit]
        ),
        'Table'[Category] = "actual"
    )
VAR plan =
    CALCULATE (
        SWITCH (
            SELECTEDVALUE ( 'Table (2)'[row] ),
            "Gross Margin", 'Table'[Gross Margin],
            "Profit", 'Table'[Profit]
        ),
        'Table'[Category] = "plan"
    )
RETURN
    SWITCH (
        SELECTEDVALUE ( 'Column'[Column] ),
        "actual", actual,
        "plan", plan,
        plan - actual
    )

and another 2 tables showed as below:

Table    ColumnTable ColumnTable       Table(2)Table Table(2)

Finally you will see:

 

1123.png

 

For the related .pbix file,pls click here.

 

Best Regards,

Kelly

 

This one is tricky. Create a diff column. for these you need to use actual and plan as filter. 

The using summarize and union , you have to merge the current result with new columns.

 

 

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can create a measure Variance = [actual] - [plan]

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.