# Issues with Totals for Dax Measure

Hi all,

I have a DAX measure which is giving me the results for each row as expected, but at the end it should also give me the totals, so in this case 42.18.
I have looked at the forum to find a solution, but whatever I tried, it all returns a total of 0,00 in the end.

This is the measure:

Marge issue =

IF(
[DGM %] < 0.49,
[Commission]*-1, BLANK() )

This is what i have tried so far:

Marge 2 =
SUMX(
VALUES
(‘Clients Thomas’[Code]),
“Client” , ‘Clients Thomas’[Code],
“Margin Corr” , [Marge issue] ),
[Marge issue]
)

Marge 3 =
IF(
HASONEVALUE( ‘Clients Thomas’[Code]),
[Marge issue],
SUMX(
VALUES( ‘Clients Thomas’[Code]),
“Marge issue”, [Marge issue]
),
[Marge issue]
)
)

and this one:

Marge 4 = SUMX
(SUMMARIZE(
‘Clients Thomas’,
‘Clients Thomas’[Code]),
[Marge issue])

It would be great if somebody can help me to get this fixed…

Many thanks!!

please see if this post from @Greg will help to steer you in the right direction

if this does not help, then please provide a sample file that forum members can use to try to help you solve your issue.

@marieke
What is [DGM %] at the grand total?

Hi @Heather

Thank you, I know about that topic from Brian and have tried several of his solutions, but without any luck unfortunatelly…

I have attached a copy of the PBI file, it would be great if somebody knows how to fix this…

Sale Commission Thomas Dummy.pbix (743.9 KB)

I have now attached a copy of the file to make things more clear…(hopefully)

Hello @marieke,

Thank You for posting your query onto the Forum.

To achieve the results of “Grand Totals” below is the formula alongwith the screenshot of the result provided for the reference -

``````Marge - Harsh =
SUMX(
SUMMARIZE(
VerkoopFacturen ,
'Clients Thomas'[Code] ,
Debiteuren[KlantNaam] ,
VerkoopFacturen[FactuurNummer] ,
VerkoopFacturen[FactuurRegel] ,
"Totals" ,
[Marge issue] ) ,
[Totals] )
``````

And if you want to convert the numbers and totals into the postive from negative than just use “ABS()” function. Below is the formula and screenshot of the result provided for the reference -

``````Marge - Harsh =
SUMX(
SUMMARIZE(
VerkoopFacturen ,
'Clients Thomas'[Code] ,
Debiteuren[KlantNaam] ,
VerkoopFacturen[FactuurNummer] ,
VerkoopFacturen[FactuurRegel] ,
"Totals" ,
ABS( [Marge issue] ) ) ,
[Totals] )
``````

Also attaching the working of the PBIX file for the reference.

Hoping you find this useful and meets your requirements that you’ve been looking for.

Note: The figure is off by 0.01 and this could due to decimal formatting. If we move the decimal portion to 3 places than we get the results as 42.187.

Thanks and Warm Regards,
Harsh

Sale Commission Thomas Dummy.pbix (743.5 KB)

1 Like

I was working this one at the same time as @Harsh, and came up with a nearly identical solution:

Marg Issue2 =

``````VAR Result =
SUMX (
SUMMARIZE (
'VerkoopFacturen',
'Clients Thomas'[Code],
'Debiteuren'[KlantNaam],
'VerkoopFacturen'[FactuurNummer],
'VerkoopFacturen'[FactuurRegel]
),
"@BaseMeas", [Marge issue]
),
[@Basemeas]
)
RETURN
Result
``````

My solution does have one important difference - when adding extension columns to a table, it is a best practice to do so using ADDCOLUMNS, rather than SUMMARIZE.