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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
qvdrago
Contributor III
Contributor III

Compare values of the same field

Hi,

we have a table "Order" with a field "Season" and we would like to compare values of two seasons.

We would like to avoid creating the second table in the script, also because it doesn't work if we then filter by article.

 

What to avoid:

TotalSeason:
Load Season as TotSeason, Sum(Qty) as TotQty
resident Order
group by Season;

Thanks.

 

Labels (1)
2 Replies
qvdrago
Contributor III
Contributor III
Author

Here is the script to generate sample data:

 

 

SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='€ #.##0,00;-€ #.##0,00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET MonthNames='gen;feb;mar;apr;mag;giu;lug;ago;set;ott;nov;dic';
SET DayNames='lun;mar;mer;gio;ven;sab;dom';

Order:
LOAD * INLINE [
    Season, Article, Qty
    E23, AAA, 10
    E23, AAA, 20
    E24, BBB, 30
    E24, AAA, 40
    E24, CCC, 50
    E23, CCC, 20
    I23, AAA, 10
    I23, BBB, 40
    I24, AAA, 30
    I24, CCC, 60
   
];

TabSeason2:
Load distinct Season as CompareSeason
resident Order;


TotalSeason:
Load Season as TotSeason, Sum(Qty) as TotQty
resident Order
group by Season;

qvdrago
Contributor III
Contributor III
Author

hI,

As I said

We would like to avoid creating the second table in the script, 

Thank you