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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
AquilaVictrix
Regular Visitor

Total row not showing the correct amount

Hello i have this issue, i have a Measure called  $ / Ton

 

$ / Ton = SUM(BD[MXN]) / SUM(BD[Movidas])

Also this measure called Impacto:

Impacto =

SUMX(

    VALUES('BD'[Ruta]),

    VAR VolumenAuto = CALCULATE(SUM('BD'[Movidas]), 'BD'[Transporte] = "Auto")

    VAR VolumenFFCC = CALCULATE(SUM('BD'[Movidas]), 'BD'[Transporte] = "FFCC")

    VAR CostoPorTonAuto = CALCULATE([$ / Ton], 'BD'[Transporte] = "Auto")

    VAR CostoPorTonFFCC = CALCULATE([$ / Ton], 'BD'[Transporte] = "FFCC")

    RETURN

        IF(VolumenAuto > 0 && VolumenFFCC > 0,

            ROUND((CostoPorTonAuto - CostoPorTonFFCC) * VolumenAuto, 0),

            0

        )

)

In the Rows the value of Imacto is correct and if i compare it with the excel data is all good but  the problem is in the total is not showing the correct amount
In PBI

AquilaVictrix_0-1742424051413.png

in Excel;

AquilaVictrix_1-1742424089733.png

 

what am i doing wrong in the Impacto Measure? thanks in advance.

 

 

1 ACCEPTED SOLUTION

*update* 

its Weird i have another table with Key Routes thata are conected to the Main BD

and with this the total is correct:

Impacto = 

SUMX(

    VALUES(Rutas[Key]),

    VAR VolumenAuto = CALCULATE(SUM(BD[Movidas]), BD[Transporte] = "Auto")

    VAR VolumenFFCC = CALCULATE(SUM(BD[Movidas]), BD[Transporte] = "FFCC")

    VAR CostoPorTonAuto = CALCULATE([$ / Ton], BD[Transporte] = "Auto")

    VAR CostoPorTonFFCC = CALCULATE([$ / Ton], BD[Transporte] = "FFCC")

    RETURN

        IF(VolumenAuto > 0 && VolumenFFCC > 0,

            ROUND((CostoPorTonAuto - CostoPorTonFFCC) * VolumenAuto, 0),

            0

        )

)



View solution in original post

10 REPLIES 10
Jihwan_Kim
Super User
Super User

Hi,

Please try something like below whether it works.

Impacto =
SUMX (
    VALUES ( 'BD'[Ruta] ),
    IF (
        CALCULATE ( SUM ( 'BD'[Movidas] ), 'BD'[Transporte] = "Auto" ) > 0
            && CALCULATE ( SUM ( 'BD'[Movidas] ), 'BD'[Transporte] = "FFCC" ) > 0,
        ROUND (
            (
                CALCULATE ( [$ / Ton], 'BD'[Transporte] = "Auto" )
                    - CALCULATE ( [$ / Ton], 'BD'[Transporte] = "FFCC" )
            )
                * CALCULATE ( SUM ( 'BD'[Movidas] ), 'BD'[Transporte] = "Auto" ),
            0
        ),
        0
    )
)


Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



Thanks for the response! @Jihwan_Kim i used the provided DAX unfortunately,  its showing still the wrong Sum at the total:

AquilaVictrix_0-1742480810419.png

 

AquilaVictrix_1-1742480852126.png

 



Hi,

It is difficult to see what is the context of the filter on the page and on the visual.

Please share your sample pbix file's link, and then I can try to look into it.

Thank you.



Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



Hi @AquilaVictrix ,

 

May I ask if you have gotten this issue resolved?

 

If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

 

Regards,

B Manikanteswara Reddy

Hi @AquilaVictrix ,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

B Manikanteswara Reddy

Hi @AquilaVictrix ,

 

May I ask if you have gotten this issue resolved?

 

If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

 

 

Please don't forget to give a "Kudos vbmanikante_1-1747315185811.png" – I’d truly appreciate it!

 

Regards,

B Manikanteswara Reddy

*update* 

its Weird i have another table with Key Routes thata are conected to the Main BD

and with this the total is correct:

Impacto = 

SUMX(

    VALUES(Rutas[Key]),

    VAR VolumenAuto = CALCULATE(SUM(BD[Movidas]), BD[Transporte] = "Auto")

    VAR VolumenFFCC = CALCULATE(SUM(BD[Movidas]), BD[Transporte] = "FFCC")

    VAR CostoPorTonAuto = CALCULATE([$ / Ton], BD[Transporte] = "Auto")

    VAR CostoPorTonFFCC = CALCULATE([$ / Ton], BD[Transporte] = "FFCC")

    RETURN

        IF(VolumenAuto > 0 && VolumenFFCC > 0,

            ROUND((CostoPorTonAuto - CostoPorTonFFCC) * VolumenAuto, 0),

            0

        )

)



lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Deku
Community Champion
Community Champion

I assume this is related to your Round(). In Power BI the total is not the sum of the rows in the table, it is calculated independly. Without more context it is hard to say 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

yes im trying to show the sum of the rows filtered (showed in the table), but the total is not right
 
 i have this as result, the total in Movidas is on spot but the Impacto is not

im using cases in the variables:
in this Var i store the volume of ton moved by truck

VAR VolumenAuto = CALCULATE(SUM('BD'[Movidas]), 'BD'[Transporte] = "Auto")


in this var the volume moved by Rail:

    VAR VolumenFFCC = CALCULATE(SUM('BD'[Movidas]), 'BD'[Transporte] = "FFCC")

   And in these, the respective cost per ton moved:

VAR CostoPorTonAuto = CALCULATE([$ / Ton], 'BD'[Transporte] = "Auto")

VAR CostoPorTonFFCC = CALCULATE([$ / Ton], 'BD'[Transporte] = "FFCC")


witch finaly calulates the Impact of using the Trucks in Rail Routes: only if the route has volume moved by truck and rail:

        IF(VolumenAuto > 0 && VolumenFFCC > 0, 

            ROUND((CostoPorTonAuto - CostoPorTonFFCC) * VolumenAuto, 0),

            0

        )
RutaMovidas$ / TonImpacto
148$390.20$10,729
2288$260.10$31,109
3142$145.60$6,431
42208$359.80$255,937
5153$955.40$90,485
6144$190.90$13,085
7502$292.90$57,928
835$177.70$1,713
972$236.10$1,473
1048$457.40$8,929
1149$1,111.30$39,255
12284$423.00$42,207
13586$913.30$377,486
14246$967.70$55,280
1548$707.00$5,602
16145$3,406.10$232,141
1748$1,022.60$2,498
1835$402.70$7,146
1970$662.40$6,449
2049$169.90$2,996
Grand Total5200$13,252.10$1,363,209

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.