Forum Discussion

vkisa's avatar
vkisa
Icon for Helper II rankHelper II
3 years ago

Summarize Table with different tables misses some rows

Hi all,

I want to create a summarized table from 2 different tables. Since the Playerid and other key columns are not unique, I put the Player, Country, Brand, Date and Region tables (as unique values) and also they are inserted as slicer filter as well. The relationships are as below, 

 

 

 

Because the TableA and TableB have many other columns, I tried to create new summarized table'

In my first attempt, this code run perfect and I got my columns as below,

 

Code:

DetailedPlayer =
SUMMARIZE(
    TableB,
    TableB[Playerid],
    TableB[DatePK],
    TableB[CountryFK],
    TableB[BrandFK],
    "Total_Sell", SUM(TableB[TotalSell]),
   "Total Deposit",SUM(TableB[TotalDeposit])
)

 

Result

 

 

When I tried to get Total Deposit column from TableB (since I want to add RegionFK from TableA) to compare results, I got this

 

Code:

SUMMARIZE(
    TableA,
    TableA[Playerid],
    TableA[BrandFK],
    TableA[DateFK],
    TableA[CountryFK],
     TableA[RegionFK],
    "Total_Sell", SUM(TableA[TotalSell]),
    "Total Deposit",CALCULATE(SUM(TableB[TotalDeposit]),
FILTER(TableB,[Playerid]=SELECTEDVALUE(TableA[Playerid]))
)
 
Result

 

The code is missing some rows as I've seen. 

How can I solve this issue?

 

Note: I've had to change name of tables/ columns from original ones, so I might be miss something 

 

Thank you,

VKisa