Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
sameershivalkar
Contributor II
Contributor II

Qliksense Table to create flag and based on flag and then hide data

Hello Team,

I am new to Qliksense,need your help

I need to create a growth flag 'Y' or 'N' based on condition were if previous month outstanding balance is less than current month balance than flag would be 'Y' ie previous (Jan 19 is 1000 )and Current month ( ie Feb 19 is 2000 )then Growth would be Y and if previous month outstanding balance is greater than Current balance then growth would be N ie Previous Jan 19 is 4000 and Current Feb 19 is 3000.Comparing should be based on previous and Current Month and Zone.

Finally once flag is Set need to show only data whose flag is N and hide all the data whose flag is Y.

Please refer attached excel for more details

Kindly please help.

 

4 Solutions

Accepted Solutions
Vegar
MVP
MVP

In my example I assume you are able to sort your table by month in month order Jan, Feb, March and not in alphabetical order.

GrowthZones:
Load Month, Zone, Balance
Where Flag
;
Load Month, Zone, Balance,
If(peek('Zone')=Zone, peek('Balance')< Balance, 0) as Flag
From EXCEL.Alex
Order by Zone, Month;

View solution in original post

Vegar
MVP
MVP

Try this.

DZone:
LOAD
Month_noo,
Zone,
Outstanding
From [LIB:..zone.xlsx];

Final:
LOAD
If(peek('Zone')=Zone, peek('Outstanding')< Outstanding, 0) as flag
Resident DZone
ORDER BY Zone,Month_noo;
DROP TABLE DZone;

image.png

View solution in original post

Vegar
MVP
MVP

Try this script, it should work and give you the output in the picture.

flag:
LOAD dual(Text,Num) as flag 
Inline [
Num, Text
-1, Y
0, N];

DZone:
LOAD * inline [
Month_noo,	Zone,	Outstanding
3,	Delhi,	10000
3,	Mumbai,	20000
3,	Banglore,	57410
4,	Delhi,	25100
4,	Mumbai,	7850
4,	Banglore,	24568
];
Final:
LOAD
Month_noo,	Zone,	Outstanding,
If(peek('Zone')=Zone, peek('Outstanding')< Outstanding, 0) as flag
Resident DZone
ORDER BY Zone,Month_noo;
DROP TABLE DZone, flag;

image.png

View solution in original post

sameershivalkar
Contributor II
Contributor II
Author

Thanks for your help Vegar..

View solution in original post

6 Replies
Vegar
MVP
MVP

In my example I assume you are able to sort your table by month in month order Jan, Feb, March and not in alphabetical order.

GrowthZones:
Load Month, Zone, Balance
Where Flag
;
Load Month, Zone, Balance,
If(peek('Zone')=Zone, peek('Balance')< Balance, 0) as Flag
From EXCEL.Alex
Order by Zone, Month;
sameershivalkar
Contributor II
Contributor II
Author

Hello tried this,but in the flag  for all the value it shows 0 as value

Vegar
MVP
MVP

Try this.

DZone:
LOAD
Month_noo,
Zone,
Outstanding
From [LIB:..zone.xlsx];

Final:
LOAD
If(peek('Zone')=Zone, peek('Outstanding')< Outstanding, 0) as flag
Resident DZone
ORDER BY Zone,Month_noo;
DROP TABLE DZone;

image.png

sameershivalkar
Contributor II
Contributor II
Author

Tried above solution,it displays 0 in flag column
Vegar
MVP
MVP

Try this script, it should work and give you the output in the picture.

flag:
LOAD dual(Text,Num) as flag 
Inline [
Num, Text
-1, Y
0, N];

DZone:
LOAD * inline [
Month_noo,	Zone,	Outstanding
3,	Delhi,	10000
3,	Mumbai,	20000
3,	Banglore,	57410
4,	Delhi,	25100
4,	Mumbai,	7850
4,	Banglore,	24568
];
Final:
LOAD
Month_noo,	Zone,	Outstanding,
If(peek('Zone')=Zone, peek('Outstanding')< Outstanding, 0) as flag
Resident DZone
ORDER BY Zone,Month_noo;
DROP TABLE DZone, flag;

image.png

sameershivalkar
Contributor II
Contributor II
Author

Thanks for your help Vegar..