Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
zied_ahmed1
Specialist
Specialist

condition in script

I need to do the condition :

i have four fields:

car

date

parc

country

if i have one car in 2 differents parc in the same date i need to put these cars in flags

how to do it thanks 

4 Replies
arockiyaselvana
Partner
Partner

Hi,

Try this...

Map_Count:

Mapping LOAD car&'-'&date as Key,

                             Count(parc) as Count

FROM File

Group By car, date;

Main_Table:

LOAD *,

           If(Count>1,1,0) as Flag;

LOAD car,

            date,

            parc,

           Applymap('ap_Count',car&'-'&date) as Count,

            country

FROM File;

Pls let us know if your requirement is different.

chhavi376
Creator II
Creator II

Hi Zied,

You can try this

Temp:

LOAD Car,

     Date,

     Parc,

     Country

   

FROM

<<Your data source>>

Count1:

LOAD Car,

     if(Count(DISTINCT Parc)>1,1,0) as Flag

      Resident Temp  group by Date,Car;

In your expression, you can write if sum(Flag)>0, 1,0

I hope this helps.

also, if you share the QVW with us, It would give a better clarity.

PFB: screenshots for better clarity

data.PNG

output.PNG

ahaahaaha
Master
Master

Hi,

Can be like this if I understood the task correctly?

Table1:

LOAD*Inline

[date, car, parc, country

01.01.2017, car1, parc1, country1

02.01.2017, car2, parc2, country2

03.01.2017, car3, parc3, country3

03.01.2017, car3, parc2, country3

04.01.2017, car1, parc1, country1

04.01.2017, car1, parc6, country1

04.01.2017, car1, parc2, country1];

Left Join

LOAD

date,

car,

If(Count(parc)>1, 1, 0) as Flag //

Resident Table1

Group By date,car;

Result

5.jpg

Regards,

Andrey

zied_ahmed1
Specialist
Specialist
Author

thanks for everybody i find another solution to resolve it