Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
B | C |
01 | 7% |
01 | 7% |
01 | 7% |
02 | 5% |
02 | 5% |
02 | 5% |
03 | 7% |
03 | 7% |
03 | 7% |
I want to calculate sum of B but I want to take only one instance of B for every A. For eg: it should be (7+5+7) ie 7 for A-01 5 for A-02 7 for A-03
You could try something like
=sum(aggr(avg(C), B))
Alternatively, you can replace avg with min, max or only, depending on what you want to happen if there are multiple values in column c for a given value in column b? Below I altered your example slightly, so that you can see what the output would be if for B=01, if you have two different values in column C
Please like and mark my answer as a solution, if it resolved your issue.
Something like this.
NoConcatenate
Tmp:
Load * Inline [
Row, B, C
1, 01, 7%
2, 01, 7%
3, 01, 7%
4, 02, 5%
5, 02, 5%
6, 02, 5%
7, 03, 7%
8, 03, 7%
9, 03, 7%
]
;
NoConcatenate
Final:
Load
Row,
If(B=Peek(B),Peek('A')+1,1) AS A,
B,
C
Resident Tmp
;
Drop Table Tmp;