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: 
naziralala
Creator
Creator

Order By in csv file

Hi All,

I have the foll script as below:

Do while vCurrYear>=vYearToLoad

[Temp Data Output Aggr]:

Load

Region,

City,

[Check week] ,

[Booking Year] as [Year],

Count([BookingID]) as [Bookings]

Resident [Tmp Data Output]

Where [Booking Year]=$(vCurrYear)

Group By Region,City,

         [Check week]

         [Booking Year]

        Order By

Region,City,

         [Check week]

         [Booking Year];

Let vCurrYear=($(vCurrYear)-1);

loop;

//in my case loops thru 3 times, 2015, 2014 and 2013

STORE

Region,

City,

[Check week] ,

[Year],

[Bookings]

FROM [Temp Data Output Aggr] INTO [$(vOutfileAggr)](txt);

I need the output as below:

Region   City Check week  Year Bookings

Mauritius CAT 1                  2013     34

Mauritius CAT 1                  2014    36

Mauritius CAT 1                  2015     38

Mauritius CAT 2                  2013     32


Can someone assist.

I am currently getting as below:

Region   City Check week  Year Bookings

Mauritius CAT 1                  2015     38

Mauritius CAT 2                  2015     37

Mauritius CAT 3                 2015     31


Thanks in advance.



4 Replies
hemhund2016
Creator
Creator

Hi,

Can you paste the dashboard log?

naziralala
Creator
Creator
Author

Can you please explain ?

swuehl
MVP
MVP

Why do you need the LOOP here?

[Temp Data Output Aggr]:

Load

Region,

City,

[Check week] ,

[Booking Year] as [Year],

Count([BookingID]) as [Bookings]

Resident [Tmp Data Output]

Where [Booking Year] >= $(vYearToLoad)

Group By Region,City,

         [Check week]

         [Booking Year]

        Order By

Region,City,

         [Check week]

         [Booking Year];

//in my case loops thru 3 times, 2015, 2014 and 2013

STORE

Region,

City,

[Check week] ,

[Year],

[Bookings]

FROM [Temp Data Output Aggr] INTO [$(vOutfileAggr)](txt);

naziralala
Creator
Creator
Author

Thanks.. that's the correct answer. It works perfect..