Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Triming repeated data

Hi,

I am importing some tables from a DAtabase.

In one of the tables there is attribute 'xyz'

Now, This Attribute has values as multiple numbers followed by comma(,) and some of them may have the data

Something like this:

235,235,235

211,222,275,

256,289

Now for the first row(235,235,235) IN a Pivot table I would like to view it only as '235' without affecting the value of other rows.

i.e row (211,222,275) should appear as it is.

Is it possible.?

Thanks & Regards,

Rohit

2 Replies
Not applicable
Author

Hi,

Here you go.

Check the attached application.

Your code should be as follow.



Test:
Load Product,
subfield(Sales,',') as Sales_New,
Sales;
LOAD * INLINE [
Product, Sales
a, "235,235,235"
b, "235,236,237"
c, "222,222,222"
d, "222,223,224"
];
Test1:
Load Product,
if(Peek(Product) = Product and peek(Sales_New) = Sales_New, Sales_New,Sales) as Sales_New1,
Len(if(Peek(Product) = Product and peek(Sales_New) = Sales_New, Sales_New,Sales)) as Length,
Sales,
Sales_New
Resident Test;
Drop Table Test;
Right Join(Test1)
Load Product,
Min(Length) as Length
Resident Test1 group by Product;




-Peterson





spsrk_84
Creator III
Creator III

Hi,

one solution use a if condition but it works for only one selected value as of now

like

assume ur field name is Value

in that write the if condition like

if( Value= ' 235 , 235 , 235 ' , left(Value,3) , Value) as Value if u use this logic in script

else it will be like thiis if( Value= ' 235 , 235 , 235 ' , left(Value,3) , Value)

check this i hope it is solved..

Regards,

Ajay