cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Rows are getting duplicated due to 1 column

Vinay_47
Explorer
0 Kudos
346

I have two columns named Id and approvers

1st row Id no 1 has values David;Musta;

2 nd row Id no 1 has values Vinay;

3rd row Id no 1 has values Kronid;

I want the outcome as single line and Id should have only 1 and Approvers values should be David;Musta;Vinay;Kronid 

can someone help me on this please

Accepted Solutions (1)

Accepted Solutions (1)

ayman_salem
Active Contributor

Define the following variables:

v_approvers:  =(Previous(Self; ([Id]))+([approvers]))

v_approvers_max:  =NoFilter(Max([v_approvers])) ForEach ([Id])

v_status:   =NoFilter(If ([v_approvers] = Max([v_approvers]) In ([Id])) Then "D"; All )

then hide the coulmn "approvers" and apply the filter (v_status equal to "D") to the table

B_20250131_1.JPG

B_20250131_2.JPG

...

hope it helps

 

ThorstenHoefer
Active Contributor
0 Kudos

Hi,

have you checked STRING_AGG?

 

    WITH +f AS (
     SELECT DISTINCT currency , carrid FROM sflight
    )
    SELECT f~currency AS cur
         , STRING_AGG( f~carrid , ',' )  AS car
    FROM +f AS f
    GROUP BY f~currency
    INTO TABLE (lt_msg).


    out->write( lt_msg ).

 

Answers (0)