Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
mario-sarkis
Creator II
Creator II

Condition Date

Hey all ,

If I have a table with a daily Date Example:

the table contain ID Balance and Date  and the date has form as (01/01/2016)

I need to extract for previous month the Balance as at end of month and for the maximum for current month from the script since the table from database is too large and I want to extract to table with these condition .

How can I write the "Where" Condition ?

Hope you can help

Thanks,

4 Replies
sunny_talwar

Would you be able to share few rows of data and explain what you want to extract from it?

mario-sarkis
Creator II
Creator II
Author

Hey Sunny , Thank you for Your Response. unfortunately I can't share my data here but here is an example and hope this will be clear:

let's say each ID has a balance evry day but I need to extract from my database to table that contain the balance only for end of each month and for current month the maximum date (not the whole month) below the table and my output would be red cells hope you can help thank you so much :

   

IDDate Balance
101/01/20161000
112/01/201612000
126/01/201626000
127/01/201627000
128/01/201628000
129/01/201629000
130/01/201630000
131/01/201631000
101/02/201632000
116/02/201647000
117/02/201648000
118/02/201649000
119/02/201650000
120/02/201651000
121/02/201652000
122/02/201653000
123/02/201654000
124/02/201655000
125/02/201656000
126/02/201657000
127/02/201658000
128/02/201659000
129/02/201660000
101/03/201661000
102/03/201662000
103/03/201663000
104/03/201664000
105/03/201665000
106/03/201666000
107/03/201667000
108/03/201668000
109/03/201669000
110/03/201670000
111/03/201671000
112/03/201672000
113/03/201673000
114/03/201674000
115/03/201675000
116/03/201676000
sunny_talwar

May be something like this:

Table:

LOAD ID,

           Date,

           Date(MonthStart(Date), 'MMM-YYYY') as MonthYear,

          Balance

FROM .....;

Right Join (Table)

LOAD ID,

           MonthYear,

          Max(Date) as Date

Resident Table

Group By ID, MonthYear;

There are multiple other ways to do this... but this should give you a table with only max date for each MonthYear and ID....

mario-sarkis
Creator II
Creator II
Author

Ok sunny thanks , let me try is and get bet to you.