How to Sum without the numbers from duplicate rows?

113 Views Asked by At

I have this set of table on my report:

Order Id Denomination Unit Amount code
04214214421412 100 80000 1
04214214421412 50 50000 2
0215424214214214 100 90000 1
21421421421 50 6000 1
21421421421 100 5000 2
909992134213 100 3000 2

I have made the below two separate tables to sum with only two columns and it returns the right sum values:

Table 1

Denom (=[Denomination]) Total Amount (=Sum[Unitamount] Where ([Code] = 1))
100 170000
50 6000

Table 2

Denom (=[Denomination]) Total Amount (=Sum[Unitamount] Where ([Code] = 2))
100 8000
50 5000

I added a dimension to give the main table specific datetime which duplicate some of the rows:

Order Id Denomination Unit Amount code Datetime
04214214421412 100 80000 1 09-02-03 01:02:33
04214214421412 100 80000 1 09-02-03 01:02:35
04214214421412 100 80000 1 09-02-03 01:02:38
04214214421412 50 50000 2 09-02-03 01:02:36
04214214421412 50 50000 2 09-02-03 01:02:34
0215424214214214 100 90000 1 09-02-03 01:02:37
0215424214214214 100 90000 1 09-02-03 01:02:39
21421421421 50 6000 1 09-02-03 01:02:39
21421421421 50 6000 1 09-02-03 01:02:41
21421421421 100 5000 2 09-02-03 01:02:43
909992134213 100 3000 2 09-02-03 01:02:39
909992134213 100 3000 2 09-02-03 01:02:42

So the other two tables get affected, all the duplicated rows are being counted:

Denom =[Denomination] Total Amount =Sum[Unitamount] Where ([Code] = 1)
100 420000
50 12000

Table 2

Denom =[Denomination] Total Amount =Sum[Unitamount] Where ([Code] = 2)
100 11000
50 10000

How to get the sum value like it's before I added the new dimension?

I have already tried setting the cardinalities between tables on data foundation (one to one, one to many, etc.) I also used ForEach, ForAll and In functions on the sum formula but the result is either #Multivalue or the same.

Thank you.

0

There are 0 best solutions below