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

Budget Minus Margin Calculation

Hi All,

 

I'am encountering some problems in calculating budget minus maring (per week and per account).

I calculating over 3 tables:

Account for the account name, Budget for the budget and margin from a margin table. 

 

I'am using this calculation:

Verschil = CALCULATE(
	SUM(Easyflex_data[Marge]) 
	-
	SUM(Begroting[Budget]);
	FILTER(ALL('Date'); 'Date'[week] <= 'Date'[week]);
	FILTER(ALLSELECTED(Account); Account[Account name] = Account[Account name]))

But I get this answer: (where marge stands for margin and verschil for difference)

budget vs margin.PNG

 

I also tried this calculation:

Verschil = CALCULATE(
	SUM(Easyflex_data[Marge]) 
	-
	SUM(Begroting[Budget]))

But with this incorrect result, I figured out that the calculation adds twice the budget.

twice the budget.PNG

 

Does anyone know what I'm doing wrong and what is a possible solution to this problem?

Many thanks in advance.

 

Ronald

 

 

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@Anonymous

 

In this scenario, both Easyflex_data and Begroting table suppose to have foreign key columns connecting Date and Account dimension table. If you want to calculate the different group on week and account, you can use ALLEXCEPT() in your calculation to group on [week] and [Budhet].

 

Verschil =
CALCULATE (
    SUM ( Easyflex_data[Marge] ),
    ALLEXCEPT (
        Easyflex_data,
        RELATED ( 'Date'[week] ),
        RELATED ( Account[Account name] )
    )
)
    - CALCULATE (
        SUM ( Begroting[Budget] ),
        ALLEXCEPT (
            Begroting,
            RELATED ( 'Date'[week] ),
            RELATED ( Account[Account name] )
        )
    )

 

 If you still get incorrect result, please share some sample data in your source table. I still can't understand the currency format in your screenshots.

 

Regards,

View solution in original post

1 REPLY 1
v-sihou-msft
Employee
Employee

@Anonymous

 

In this scenario, both Easyflex_data and Begroting table suppose to have foreign key columns connecting Date and Account dimension table. If you want to calculate the different group on week and account, you can use ALLEXCEPT() in your calculation to group on [week] and [Budhet].

 

Verschil =
CALCULATE (
    SUM ( Easyflex_data[Marge] ),
    ALLEXCEPT (
        Easyflex_data,
        RELATED ( 'Date'[week] ),
        RELATED ( Account[Account name] )
    )
)
    - CALCULATE (
        SUM ( Begroting[Budget] ),
        ALLEXCEPT (
            Begroting,
            RELATED ( 'Date'[week] ),
            RELATED ( Account[Account name] )
        )
    )

 

 If you still get incorrect result, please share some sample data in your source table. I still can't understand the currency format in your screenshots.

 

Regards,

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.