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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply

Still can't get table to SUM up

Good day All...

 

I've been wrestling with trying to get my totals to match for over 3 months, but with no success.  I have watched COUNTLESS videos explaing various ways to use SUMX, CALCULATETABLE, and vTables.  My measure seems to be doing it correctly, except for 1 store...All other totals are correct and I'm looking for an explanation as to why 99% of totalling works with the measure, all but a single store.


My measure reads as follows:
In which I have 2 different __VAR methods...Both which fail to correctly sum up the total correctly FOR JUST A SINGLE STORE.

 

AckKNBelopp_156Ack = 
VAR __CurrentAck = DISTINCT('Report156'[156AckTotalsSortby])
VAR __TempTable=        
        CALCULATETABLE(
                    ADDCOLUMNS(
                                SUMMARIZE(Report156_Ack;Report156_Ack[Period];Report156_Ack[ButikRegion];Report156_Ack[Butik];Report156_Ack[Leveranssätt];Report156_Ack[Saljkanal]);
                                "SummedKB";[AckKnBel]
                              )
                      )
VAR __VAR1=        
               CALCULATE(
                   SUMX(__TempTable;[SummedKB]
                              )
                             )
VAR __vTable=        
        ADDCOLUMNS(
                    CROSSJOIN(
                                VALUES(Report156_Ack[Period]);
                                VALUES(Report156_Ack[ButikRegion]);
                                VALUES(Report156_Ack[Butik]);
                                VALUES(Report156_Ack[Leveranssätt]);
                                VALUES(Report156_Ack[Saljkanal])
                              );
                    "@SummedKB";[AckKnBel]
                    )
VAR __VAR2=        
               CALCULATE(
                   SUMX(__vTable;[@SummedKB]
                              )
                             )
                             
VAR __VAR3 = Sum(Report156[AckKNBelopp])
Return
IF(HASONEFILTER(Report156[156AckSortby]);
    Round(__VAR3;0);
    ROUND(__VAR2;0)
)

 

2025-03-17 141217.jpg
 Any tricks to get this single store to fall in line, without compromising the other correctly calculated totals, would be deeply appreciated.

9 REPLIES 9
v-venuppu
Community Support
Community Support

Hi @jetform_consult ,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.

Thank you.

v-venuppu
Community Support
Community Support

Hi @jetform_consult ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

v-venuppu
Community Support
Community Support

Hi @jetform_consult ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @ZhangKun @johnt75 @Deku @bhanu_gautam  for the prompt response.

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

ZhangKun
Super User
Super User

This problem is due to Auto-Exist, you can check the link below to understand.

Understanding DAX Auto-Exist 

The short answer is that you should always use dimension tables.

Thanks for your reply...I'll try TREATAS and see what happens.

johnt75
Super User
Super User

The first thing I would check is that HASONEFILTER is behaving as you expect it to. Change the returns to e.g. 1 and 2 so you can easily identify the behaviour on different rows. Alternatives to HASONEFILTER could be HASONEVALUE and ISINSCOPE, though I am unsure as to how ISINSCOPE works with sort by columns.

The second thing I would try is removing the rounding to return the full result. The difference between the total shown and the actual total is small enough to be simply rounding error.

Deku
Super User
Super User

It is off by 1 and you using ROUND(). The Total is calculated independly of the other rows in the Table. Remove the Round and check to see if it adds up correctly


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

@jetform_consult Try using

 

AckKNBelopp_156Ack =
VAR __CurrentAck = DISTINCT('Report156'[156AckTotalsSortby])
VAR __TempTable =
CALCULATETABLE(
ADDCOLUMNS(
SUMMARIZE(
Report156_Ack,
Report156_Ack[Period],
Report156_Ack[ButikRegion],
Report156_Ack[Butik],
Report156_Ack[Leveranssätt],
Report156_Ack[Saljkanal]
),
"SummedKB", [AckKnBel]
)
)
VAR __VAR1 =
CALCULATE(
SUMX(__TempTable, [SummedKB])
)
VAR __vTable =
ADDCOLUMNS(
CROSSJOIN(
VALUES(Report156_Ack[Period]),
VALUES(Report156_Ack[ButikRegion]),
VALUES(Report156_Ack[Butik]),
VALUES(Report156_Ack[Leveranssätt]),
VALUES(Report156_Ack[Saljkanal])
),
"@SummedKB", [AckKnBel]
)
VAR __VAR2 =
CALCULATE(
SUMX(__vTable, [@SummedKB])
)
VAR __VAR3 = SUM(Report156[AckKNBelopp])
RETURN
IF(
HASONEFILTER(Report156[156AckSortby]),
ROUND(__VAR3, 0),
ROUND(__VAR2, 0)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks for your reply.

 

I made your suggested code changes, but to no avail.

I am attempting to bring our RS156 report into PowerBI, but can't until I get this totaling issues sorted.

jetform_consult_0-1742227001685.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.