Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

qlik issue

i have a field x and y

y is a flag with values n and y

but for few of the values in x field am getting both n and y values because of this there is an isue wwith the expressions total values

so i want to rectify this y field ,

x      y

23    n

23    y

like this

it should ideally be havinf only one value assigned

9 Replies
tresesco
MVP
MVP

And out of n and y, which one would you like to keep?

Anonymous
Not applicable
Author

actually what i want for any of the values in x the y shud either be y or n

this is the issue with the data ,

so may be if we can assign some integer values or so ,?

tresesco
MVP
MVP

I guess, if you have a look into the data set in a broader view, you would probably be able to find a logic to decide upon - 'y' or 'n' - which to keep or even if they are at all irrelevant or not. If not, and you just can remove any of them, you could probably first identify the duplicates and remove them using exists() or distinct load or even hard code loading for the y field. Try to provide a sample data set (with similar to real data) to get more specific help on how to remove duplicates.  

kenphamvn
Creator III
Creator III

Hi

Try this

TestTable:

LOAD * INLINE [

    Col_X, Col_Y

    A, y,

    B, ny

    C, yn

    D, n

];

NoConcatenate

Table:

load Col_X,Col_Y

Resident TestTable

where Len(Col_Y)=1;

Concatenate

load Col_X, SubField(Left(Col_Y,1)&'/'&Right(Col_Y,1),'/') as Col_Y

Resident TestTable

where Len(Col_Y)=2;

Drop Table TestTable

Anonymous
Not applicable
Author

do u mean to say :

x      y

23    n

23    y

i shud hardcode for all these x values as ny or yn?

kenphamvn
Creator III
Creator III

Hi

Sorry i miss understood.

Please try again

TestTable:

LOAD * INLINE [

    Col_X, Col_Y

    A, y,

    B, n

    A, y

    D, n

    B, y

];

NoConcatenate

Table:

load Col_X,if (len( Concat(Col_Y) ) >1,'X',Concat(Col_Y)) as Col_Y

Resident TestTable

group by Col_X

;

Drop Table TestTable

Anonymous
Not applicable
Author

thanks so much for your response and help,

but need to understand what do you mean by 'X' over here?

or if u can share sample what will the output data for this?

please

kenphamvn
Creator III
Creator III

Hi

'X' is default values when Col_X has both n and y values


Output here

8-17-2017 14-28-20.jpg

Anonymous
Not applicable
Author

ok,thanks so much for the help,

actually am using this coly values in my expressions as:count({$<Col_Y={'N'}>}Col_X)

count({$<Col_Y={'Y'}>}Col_X)

count(distinct Col_X), the total value here shud be sum of two abve ,

col_x has integer values