Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am trying to extract data in the following way:
we would not have repetitive periods within the same Dep_Name, Sub_ID, and Control_ID
Example below
Dep_Name | PERIOD | Dep_Control | Sub_ID | Control_ID | Control_VALUE |
A | 201312 | 1 | 1a | C0A01 | 400 |
A | 201609 | 0 | 1a | C0A01 | -600 |
A | 201312 | 0 | 1b | C0B01 | 500 |
A | 201312 | 0 | 1c | C0B01 | 2 |
A | 201609 | 1 | 1c | ||
A | 201312 | 1 | 1d | C0C02 | 70 |
B | 201312 | 0 | 1a | C0A01 | 30 |
B | 201312 | 0 | 1a | C0B02 | -560 |
B | 201609 | 1 | 1a | C0B01 | 370 |
B | 201312 | 0 | 1b | C0C01 | 400 |
B | 201609 | 0 | 1b | C0C01 | 230 |
we would only have 1st row so the table should only have 1 record
Dep_Name | PERIOD | Sub_ID | Control_ID | Control_VALUE |
A | 201312 | 1a | C0A01 | -400 |
I was able to make it work when selecting individual Dep_Name but it was not working without the selection.
=-1*Sum({$<
Dep_Name={'=count(distinct Dep_Control)=2'},
Control_ID={'=count(distinct Dep_Control)=2'},
Sub_ID={'=count(distinct Dep_Control)=2'},
PERIOD={$(MinPeriod)}
>} Control_VALUE)
MinPeriod = 201312
Can you please help?
Thanks,
Janus
Hi Janus,
try this in Expression
=Aggr(If(Count(Sub_ID)=2,Only({<PERIOD={'$(MinPeriod)'},Dep_Control={1}>} Control_VALUE)),Dep_Name,Sub_ID)
If You need then add - sign
Regards,
Antonio
Hi Janus,
try this in Expression
=Aggr(If(Count(Sub_ID)=2,Only({<PERIOD={'$(MinPeriod)'},Dep_Control={1}>} Control_VALUE)),Dep_Name,Sub_ID)
If You need then add - sign
Regards,
Antonio
Brilliant! It's working perfectly with my dataset. Another solution here.
=Aggr(If(Count(distinct Dep_Control)=2,Only({<PERIOD={'$(MinPeriod)'},Dep_Control={1}>} -1*Control_VALUE)),Dep_Name,Sub_ID, Control_ID)