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

Subtract the value of a measure by the value of a column

Hey 🙂
I have a table with the following structure:

Sector  Budget   Year
AAA 6.000 2021
BBB 13.000 2021
CCC 8.000 2021


I also have a measure that calculates the total sum of expenses for each sector (this data coming from another table).
I want a measure that do the Budget - Total Spent, for each Sector,  but I don't know how to subtract the value of a column by a measure.


Can someone help me?

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

Hi @Anonymous 

I think you can subtract the value of a measure by the value of a column by another measure.

Here I build a sample.

Budget Table:

1.png

Expense Table:

2.png

Expense measure:

Measure = 
CALCULATE (
    SUM ( Expense[Expense] ),
    FILTER (
        Expense,
        Expense[ Year] = MAX ( Budget[ Year] )
            && Expense[Sector  ] = MAX ( Budget[Sector  ] )
    )
)
Expense = 
SUMX(Budget,[Measure])

Subtract measure:

Result = SUM(Budget[Budget  ]) - [Expense]

Result is as below.

1.png

Best Regards,

Rico Zhou

 

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

Best Regards,

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

I think you can subtract the value of a measure by the value of a column by another measure.

Here I build a sample.

Budget Table:

1.png

Expense Table:

2.png

Expense measure:

Measure = 
CALCULATE (
    SUM ( Expense[Expense] ),
    FILTER (
        Expense,
        Expense[ Year] = MAX ( Budget[ Year] )
            && Expense[Sector  ] = MAX ( Budget[Sector  ] )
    )
)
Expense = 
SUMX(Budget,[Measure])

Subtract measure:

Result = SUM(Budget[Budget  ]) - [Expense]

Result is as below.

1.png

Best Regards,

Rico Zhou

 

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

Best Regards,

amitchandak
Super User
Super User

@Anonymous ,

You need to have a common sector and year/date table , Joining back with these tables

 

Using the common table you can analyze data together (Measure from both tables)

 

Sector Table = distinct(union(distinct(Budget[Sector]),distinct(Actual[Sector])))

 

Bridge Table: https://www.youtube.com/watch?v=Bkf35Roman8&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=19

 

 

In case your data are at a different level

Distributing/Allocating the Yearly Target(Convert to Daily Target): Measure ( Daily/YTD): Magic of CLOSINGBALANCEYEAR With TOTALYTD/DATESYTD: https://community.powerbi.com/t5/Community-Blog/Power-BI-Distributing-Allocating-the-Yearly-Target-Convert-to/ba-p/1476400

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.