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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

problem with date fields

Hi All,

I have script like below

Load  Extract_Name,

          Record_count,

          Processed_date

from table.qvd(qvd);

My table in Table_Viewr like

Extract_NameRecord_count,Processed_date
A.QVW

10000

01/03/2018
B.QVW2000001/03/2018
C.QVW3000001/03/2018
A.QVW900001/02/2018
B.QVW1800001/02/2018
C.QVW2700001/02/2018

My table has multiple records

the table gives the record count for each refresh,

the Processed_Date has today function,.

I want design one report like below.

Extract_NameCurrent Refresh dateCurrent Refresh CountPrior Refresh datePrior Refresh Count
A.QVW01/03/20181000001/02/20189000
B.QVW01/03/20182000001/02/201818000
C.QVW01/03/20183000001/02/201827000

I know like how to get current and prior dates like below

If(Processed_date=Today(),Processed_date) as Current Refresh date

If(Processed_date=Today()-1,Processed_date) as Prior Refresh date

But it is not fullfill my above requirement.

I need do to get only 2 records for each QVW (i.e.Current Refresh date and Prior Refresh date)

Thanks in advance

Please help me out of this issue.

Thanks & Regards

Prashanth.

1 Solution

Accepted Solutions
19 Replies
sunny_talwar

Why not do this on the front end of the application rather than doing this in the script?

sunny_talwar

Check this out

Capture.PNG

Anonymous
Not applicable
Author

Hi Sunny

Thanks alot...

if i have any queries i will get back to you..

regards

Prasanth

Anonymous
Not applicable
Author

Hi Sunny,

Is there anyway to do in script level if yes please can you brief me about that if you don't mine.

regards

Prashanth.

sunny_talwar

Try this in the script

Table:

LOAD Extract_Name,

Date(Max(Processed_date)) as Current_Refresh_Date,

FirstSortedValue(Record_count, -Processed_date) as Current_Refresh_Count,

Date(Max(Processed_date, 2)) as Previous_Refresh_Date,

FirstSortedValue(Record_count, -Processed_date, 2) as Previous_Refresh_Count

Group By Extract_Name;

LOAD * INLINE [

    Extract_Name, Record_count, Processed_date

    A.QVW, 10000, 01/03/2018

    B.QVW, 20000, 01/03/2018

    C.QVW, 30000, 01/03/2018

    A.QVW, 9000, 01/02/2018

    B.QVW, 18000, 01/02/2018

    C.QVW, 27000, 01/02/2018

];

Anonymous
Not applicable
Author

Hi All,

If my Current_Refresh_Count and Previous_Refresh_Count is Same i need to give Same colour(Red) for those two fields.


i am using Pivot table.

Can you please help me out of this issue.


Thanks in advance


regards

Prashanth.

sunny_talwar

Just use red() in the background color expression

devarasu07
Master II
Master II

Hi,

in your pivot table measure -->  add below expression in both measure as background color expression

if( sum(Current_Refresh_Count) =sum(Previous_Refresh_Count) ,Red(),Black())

or

if (Column(1)= Column (2), red(),black())  // here col1 is Current referesh count and 2 is previous

also note, if u want to match data and amount same then apply below expression

if( sum(Current_Refresh_Count) =sum(Previous_Refresh_Count) and Current_Refresh_Date=Previous_Refresh_Date, Red(),Black())

Thanks,

Deva

Anonymous
Not applicable
Author

Hi Sunny,

I don't want store my historical data in my final application.means today i have only 2 records in future i might get million records.

So i just want get latest 2 records for each QVW.

Could you please help on this

Thanks in Advance

regards

Prashanth.