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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
phb
Frequent Visitor

Calculate remaining budget between two tables

I have been stuck on this problem for weeks.

 

I have the following data model:

Capture3.PNG

 

 

 rap_Sag is the project

rap_Sagsplanlægningslinjer is the budget for a project

rap_Sagspost is the consumption for a project

rap_Sagsopgave is for something different

 

I have to calculate the budget, consumption and remaining budget for projects. A project has a project number and a kategori (K1, K2, K3)

 

My challenge is that the budget tabel only has values for K1, hence budget should not been shown for K2, K3 as shown in the picture below.

Capture.PNG

 The matrix visualisation has the following values:

Capture1.PNG

 I have a table called "Kategori" to keep track of the categories, a table called "ForbrugBudget" to keep track on where the value is coming from.

 

How to create the measure for the remaining budget while still only showing budget for K1? I tried with three measures, but I can't hide empty budget columns for K2, K3.

 

My current DAX that works for budget and comsumption is:

(#1) Sum af budget + forbrug =
VAR Budget =
    CALCULATE (
        SUMX ( 'rap_Sagsplanlægningslinje', 'rap_Sagsplanlægningslinje'[Antal] ),
        'rap_Sagsplanlægningslinje'[NN-registrering] = 0
    )
VAR Forbrug =
    CALCULATE (
        SUMX ( rap_Sagspost, rap_Sagspost[Antal] ),
        USERELATIONSHIP ( rap_Sagspost[Initialer], rap_Ressource[Nummer] )
    )
VAR Samlet = Budget + Forbrug
RETURN
    IF ( Samlet = 0, BLANK (), Samlet )

 

How do I calculate for the remaining budget?

 

Thanks in advance.

 

 

 

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi  @phb ,

I created some data:

vyangliumsft_0-1653629570294.png

Here are the steps you can follow:

If you only want to display the value of K1, you can use the IF function to mark the column [ktegori], and finally put it in the Filter to set it

1. Create measure.

Flag =
IF(
    MAX('Table1'[Kategori])="K1",1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1653629570295.png

3. Result:

vyangliumsft_2-1653629570297.png

What is the remaining budget and can you express the results you want in pictures

If it is convenient, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you

 

Best Regards,

Liu Yang

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

phb
Frequent Visitor

@Anonymous ,

Thanks for your reply, but it doesn't solve my problem. You can find a sample report here https://www.dropbox.com/s/h5uvmdlot3obv15/Sample%20report.pbix?dl=0 (It doesn't seem like I can upload here). 

 

The problem is that have a mandatory column (kategori), but it should only be shown if the column has any values like the example below. Budget is not shown for K3, because it doesn't have values. Screenshot 2022-05-27 123228.png

 I tried solving it with three measures like the one below, but then the columns are always shown.

Screenshot 2022-05-27 123359.png

 

I can't figure out how to calculate "Restbudget" which is just "Budget" - "Forbrug" when I can't show columns without values.

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)