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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
ssriramin19
Contributor III
Contributor III

Priority data

Hello ,

     Can anyone explain how to prioritize data for the  below example. The logic must be ,

ID    COUNTRY

1     India

2    Australia

3   Germany

If India ,Australia and Germany is present for a particular id then only India must be displayed .and if India and Germany is present for  particular id then India must be displayed Similarly if Australia and Germany is present for particular id then Australia must be displayed and if Australia and India is present for particular id then India must be displayed .

Can anyone please help in resolving the above scenario..

Thanks

12 Replies
giakoum
Partner - Master II
Partner - Master II

you can use dual function to load the ID and COUNTRY as one field, and then use the min function to display the desired country.

I am assuming that ID defines the order in which countries display when there are more than one, so the min function should do it.

Hope I understood well.

ssriramin19
Contributor III
Contributor III
Author

Can you please explain with the script since I tried with above logic but could not able to resolve the issue.

It would be better if you could provide the script with example.

Thanks

ssriramin19
Contributor III
Contributor III
Author

Can you please explain with the script since I tried with above logic but could not able to resolve the issue.

It would be better if you could provide the script with example.

Thanks

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this

Temp:   

LOAD

    ID,

    COUNTRY,

    MATCH(COUNTRY, 'India', 'Australia', 'Germany') AS Priority;

LOAD * INLINE [  

    ID,COUNTRY

1,India

1,Australia

1,Germany

2,India

2,Australia

3,Australia

3,Germany

];

Test:

LOAD

    ID,

    COUNTRY

WHERE Flag = 1;

LOAD

    *,

    If(ID <> Previous(ID), 1, 0) AS Flag

RESIDENT Temp

ORDER BY ID, Priority ASC; 

DROP TABLE Temp;

Hope this is what you are looking for.

Regards,

Jagan.

ssriramin19
Contributor III
Contributor III
Author

Hello,

I tried the above approach but still not priority is proper based on the above country scenario. Any one please let me know the possible alternatives for resolving the issue.

Thanks

jagan
Partner - Champion III
Partner - Champion III

Hi,

The above script works for me, did you checked that in Qlikview.

Regards,

Jagan.

flipside
Partner - Specialist II
Partner - Specialist II

This should work ...

=MaxString({<ID={$(#=min(ID))}>} COUNTRY)

ssriramin19
Contributor III
Contributor III
Author

Thanks everyone for the solution provided .

ssriramin19
Contributor III
Contributor III
Author

Thanks everyone for the solution provided .