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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Antonio_Gomez
Resolver I
Resolver I

Error adding Columns (Sum)

Hello Everyone,

 

Here I'm again with doubts and errors 😞

 

In the following table the "Total" column is not adding well, as you can see for example Fishing is shown 90 instead of 97 which would be the correct result.

 

My formula is:

CantBuquesTotCorr = IF(
HASONEVALUE(V_HistoricalBbox[PUERTOS.PortNAME])
,[CantBuquesTotales]
,COUNTX(
VALUES(V_HistoricalBbox[VesselId])
,[CantBuquesTotales]
)
)

 

  • In the same table I have a column with Ports but some of them are blanks, that's why I putted HASONEVALUE(V_HistoricalBbox[PUERTOS.PortNAME])
  • CantBuquesTotales = DISTINCTCOUNT(V_HistoricalBbox[VesselId]). As I'm counting the differents Ids for the column VesselId.

 

This table shows the differents ships that call at these ports

 

Antonio_Gomez_0-1658227334519.png

 

The sum of the rows is OK, the problem is adding the columns

 

 

 

.

1 ACCEPTED SOLUTION
Antonio_Gomez
Resolver I
Resolver I

Well @v-luwang-msft @amitchandak I found the solution

 

First, I rearranged the tables. Because one table contained several merges of others and from this super table the data was being extracted.

 

So, in this new arrangement with separable tables I applied this formula:

 

CantBuquesTotCorr = IF(
HASONEVALUE(PUERTOS[PortLOCODE])
,[CantBuquesTotales]
,SUMX(
VALUES(PUERTOS[PortLOCODE])
,[CantBuquesTotales]
)
)

 

View solution in original post

6 REPLIES 6
Antonio_Gomez
Resolver I
Resolver I

Well @v-luwang-msft @amitchandak I found the solution

 

First, I rearranged the tables. Because one table contained several merges of others and from this super table the data was being extracted.

 

So, in this new arrangement with separable tables I applied this formula:

 

CantBuquesTotCorr = IF(
HASONEVALUE(PUERTOS[PortLOCODE])
,[CantBuquesTotales]
,SUMX(
VALUES(PUERTOS[PortLOCODE])
,[CantBuquesTotales]
)
)

 

v-luwang-msft
Community Support
Community Support

Hi @Antonio_Gomez ,

Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

Best Regards
Lucien

v-luwang-msft
Community Support
Community Support

Hi @Antonio_Gomez ,

Test the below,and if still not work ,could you pls share a sample data,and remember remove confidential data.

 

 

CantBuquesTotCorr =
IF (
    HASONEVALUE ( V_HistoricalBbox[PUERTOS.PortNAME] ),
    [CantBuquesTotales],
    SUMX ( V_HistoricalBbox, [CantBuquesTotales] )
)

And refer:

https://archerpoint.com/how-to-make-measures-total-correctly-in-power-bi-tables/ 

https://community.powerbi.com/t5/Desktop/Wrong-column-totals-table/m-p/565904 

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

Sorry @v-luwang-msft didn't work.

 

This is the result with your formula

Antonio_Gomez_0-1659456879833.png

 

amitchandak
Super User
Super User

@Antonio_Gomez , Ideally we should add column visual, add type and check

 

CantBuquesTotCorr = IF(
HASONEVALUE(V_HistoricalBbox[PUERTOS.PortNAME])
,[CantBuquesTotales]
,COUNTX(
Summarize(V_HistoricalBbox,V_HistoricalBbox[VesselId],V_HistoricalBbox[TYPE])
,[CantBuquesTotales]
)
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak 

 

Thanks for your participation. But, is still wrong

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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