Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Experts,
having de following data:
Group | Company | Consumption |
1 | A | 1000 |
1 | B | 2000 |
1 | C | 1000 |
2 | D | 1000 |
2 | E | 3000 |
2 | F | 4000 |
Group 1 | 4000 |
Group 2 | 8000 |
I need to concatenate the field Company based on a condition in the Consumption of the GROUP they belong. I've been able to get all the Companies concatenated when I aggregate them by Company:
CONCAT(IF(AGGR(sum(Consumption),Company)> 2000,Company),'|')
E|F
But when I try to get the Companies based on a Group agregation it doesn't work. I would expect D|E|F
CONCAT(IF(AGGR(sum(Consumption),Group)> 5000 ,Company),'|')
Could someone explain me why this is happening?
Thanks in advance
Hi Ruben,
You have to use NODISTINCT parameter in Aggr() function.
CONCAT(IF(AGGR(NODISTINCT sum(Consumption),Group)> 5000 ,Company),'|')
Hi Ruben,
You have to use NODISTINCT parameter in Aggr() function.
CONCAT(IF(AGGR(NODISTINCT sum(Consumption),Group)> 5000 ,Company),'|')
That worked perfectñy, thanks a lot.
Just curious, what is the logic behind the need of needing nodistinct?
Thanks again!
Aggr's temp table does not fit your current table Ruben.
Here is an explanation with data: