Forum Discussion

Antonio_Gomez's avatar
Antonio_Gomez
Resolver I
4 years ago
Solved

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

 

 

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

 

 

 

.

  • 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]
    )
    )

     

6 Replies