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
alandizzle
New Member

Delta DAX formula shows up twice between scenarios? How do I change that?

https://imgur.com/a/xZsiGTn

Hey guys, hopefully I wrote the DAX formula correctly?

First off, I'm just trying to show the delta between actuals and budget (in the filter scenario). But for some reason, the delta is showing up between both the actual and budget column. Any way to correct that so it shows up after budget?

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @alandizzle 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

f1.png

 

You may create a measure as below.

Result = 
IF(
    ISINSCOPE('Table'[Scenarios]),
    SUM('Table'[Costs]), 
    CALCULATE(
        SUM('Table'[Costs]),
        FILTER(
            ALL('Table'[Scenarios]),
            'Table'[Scenarios]="Actual"
        )
    )-
    CALCULATE(
        SUM('Table'[Costs]),
        FILTER(
            ALL('Table'[Scenarios]),
            'Table'[Scenarios]="Budget"
        )
    )
)

 

Then you may rename the column total of the matrix viusal as 'Delta'.

f2.png

 

Best Regards

Allan

 

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

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @alandizzle 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

f1.png

 

You may create a measure as below.

Result = 
IF(
    ISINSCOPE('Table'[Scenarios]),
    SUM('Table'[Costs]), 
    CALCULATE(
        SUM('Table'[Costs]),
        FILTER(
            ALL('Table'[Scenarios]),
            'Table'[Scenarios]="Actual"
        )
    )-
    CALCULATE(
        SUM('Table'[Costs]),
        FILTER(
            ALL('Table'[Scenarios]),
            'Table'[Scenarios]="Budget"
        )
    )
)

 

Then you may rename the column total of the matrix viusal as 'Delta'.

f2.png

 

Best Regards

Allan

 

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

AllisonKennedy
Super User
Super User

Your DAX looks ok, but the issue here is the matrix configuration. You are trying to use multiple fields in Values AND something in Columns. You must choose one or the other to avoid the duplication of the Measure in values for every value in the Column.

So, to get around it for your scenario, you just need to create two new measures - one for Actual and one for Budget. You already have this in the Delta formula, just need to copy paste the first bit into a new measure for Actual and the second bit into a new measure for Budget. Then put all three measures (Actual, Budget, Delta) into the Values part of the matrix.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.