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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Spanggaard
New Member

DAX measure does not override total in matrix

Hi all,

I've used the code below to calculate the difference between two values in a matrix - it does the job, but the actual numbers overrides my dax in regards to the total columns.

e.g. the total column in 'fælles' says that we have a total of above 800.000 but is in fact only 7.571.

Also I had to manipulate data to remove the numbers where total = 0 - but it is not on purpose that that the total is zero, it should be the sum of the columns ..

 

Spanggaard_0-1668507640850.png

 

 

Difference = 
VAR thisforecastnum =
    MIN ( Costcenter[Kost center] )
VAR thisforecast =
    SUM ( Costcenter[Faktisk Beløb] )
var lastforecastnum=CALCULATE(MAX('Costcenter'[Kost center]),FILTER(ALLSELECTED(costcenter),'Costcenter'[Kost center]<MAX('Costcenter'[kost center])))
VAR lastforecast =
    CALCULATE (
        SUM ( Costcenter[Faktisk Beløb] ),
        Costcenter[Kost center] = lastforecastnum
    )
RETURN
    IF (
        ISBLANK (lastforecast),
        SUM ( Costcenter[Faktisk Beløb]),
        IF(max('costcenter'[Kost center]) = "Fælles",
        lastforecast - thisforecast,
        BLANK()
    )
    
)

 

new_amount = IF(
     IF(sum('Costcenter'[Faktisk Beløb]) == Costcenter[Difference] && max(costcenter[Kost center]) = "fælles",
     BLANK() + 0,
     sum(Costcenter[Faktisk Beløb])),
     IF(sum('Costcenter'[Faktisk Beløb]) <> Costcenter[Difference] && max(costcenter[Kost center]) = "fælles",
     costcenter[Difference], 
     sum(Costcenter[Faktisk Beløb]))

)

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Spanggaard ,

 

Based on your description, you can create a measure.

Measure =

SUMX(

    SUMMARIZE(

        'Table',

        'Table'[RowName],

        'Table'[ColumnName],

        "total",SUM ( 'Table'[Your Measure] )

    ),

    [total]

)

 

You can refer to the following documents that may be helpful to you:

How to Make Measures Total Correctly in Power BI Tables - ArcherPoint

 

Best Regards,

Neeko Tang

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

1 REPLY 1
Anonymous
Not applicable

Hi @Spanggaard ,

 

Based on your description, you can create a measure.

Measure =

SUMX(

    SUMMARIZE(

        'Table',

        'Table'[RowName],

        'Table'[ColumnName],

        "total",SUM ( 'Table'[Your Measure] )

    ),

    [total]

)

 

You can refer to the following documents that may be helpful to you:

How to Make Measures Total Correctly in Power BI Tables - ArcherPoint

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.