Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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
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
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.
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
Hi,
The above script works for me, did you checked that in Qlikview.
Regards,
Jagan.
This should work ...
=MaxString({<ID={$(#=min(ID))}>} COUNTRY)
Thanks everyone for the solution provided .
Thanks everyone for the solution provided .