Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr function combination

Hi All,

I need to fill req. as below.

If i have ID(unique) with respect to unique LSR then i have to capture only one record count whether 1 or 0  and if i have disinct ID's with unique LSR then i have to count both id's.

Id           No           LSR                       Count(expected)

750485       165          3245002                0(whether 0 or 1)

750485       163          3245002                1 (whether 1 or 0. i.e based on opposite to above value)

543868       814          3580010                1

1372548      871          3580010                1

826682       9000         6868                      1

COUNT(AGGR(MAXSTRING(NO),LSR)) ----- This i have used to get 0 or 1 and its working.

COUNT(AGGR(MaxString(LSR),ID))----------This i have used to get 1 format.

How we can combine both expressions in a single expression.

Thanks in advance,

Harshal Patil

2 Replies
hic
Former Employee
Former Employee

It sounds as if you want to count the number of distinct combinations of ID and LSR. If so, you should use

     Count(distinct ID & '|' & LSR)

No Aggr() needed...

HIC

Not applicable
Author

Thanks Henric...

I have applied same as above...but as per my req i have to show 0 at count level.

Id           No           LSR                       Count(expected)

750485       165          3245002                0(whether 0 or 1)

750485       163          3245002                1 (whether 1 or 0. i.e based on opposite to above value)

As per your logic am getting like below

Id           No           LSR                       Count(expected)

750485       165          3245002                1

750485       163          3245002                1

                                                      total =1

Thanks,

Harshal Patil