Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

problem facing on salary_band?

Hi guys,

i have developed  qlikview application with loaded data like

emp:

Load empno,

         ename,

         sal

;

concatenate(emp)

Load empno,

         ename,

         sal

;

here i need to create in script part salary band for emp

sal_band like(0 to 1000,1000 to 20000,20000 to 100000,100000+)

i have tryed in two ways like

1)

emp:

Load empno,

         ename,

         sal,

        if(sal<=1000,'0-1000',

        if(sal>1000 and sal<=20000,'1000-20000',

        if(sal>20000 and sal<=100000,'20000-100000','100000+))) as sal_brand

;

concatenate(emp)

Load empno,

         ename,

         sal,

  sal,

        if(sal<=1000,'0-1000',

        if(sal>1000 and sal<=20000,'1000-20000',

        if(sal>20000 and sal<=100000,'20000-100000','100000+))) as sal_brand

;if i relode above sal_brand is creted but no data is getting .the above script is correct or wrong?

on more i tryed

2)

emp:

Load empno,

         ename,

         sal

;

concatenate(emp)

Load empno,

         ename,

         sal

;

concatenate(emp)

load

if(sal<=1000,'0-1000',

        if(sal>1000 and sal<=20000,'1000-20000',

        if(sal>20000 and sal<=100000,'20000-100000','100000+))) as sal_brand

;

if i relode sal_brand is creating but no data coming .


can you please suggest me how can i proceed with this ??


Best regards,

sanjeev





1 Solution

Accepted Solutions
sujeetsingh
Master III
Master III

Sanjeev ,

Then you need to fist concatenate then use the nested iff

emp:

Load empno,

         ename,

         sal

;

concatenate(emp)

Load empno,

         ename,

         sal

;

MainData:

Load *

,if(sal > 100000, '100000+',

          if(sal > 20000, '20000-100000',

          if(sal >= 1000, '1000-20000', '0-1000'))) as sal_brand

resident emp;

drop table emp;

View solution in original post

16 Replies
sujeetsingh
Master III
Master III

Send me the sample please.

Why are you using concatenate?

Check the association too

Anonymous
Not applicable
Author

Hi Use the Interval match

emp:

Load empno,

         ename,

         sal

From Location;

Table1:

Load * Inline [

min_Sal,max_Sal,Salrange

0,10000,'0 to 10000'

10001,20000,'10K to 20 K'

20001,30000,'20K to 30K'

30001,,'>30 K'

];

BridgeTable:

interval Match(sal)

Load

min_Sal,

max_Sal

Resident Table1;

ecolomer
Master II
Master II

Try to use function INTERVALMATCH (Extended)

jagan
Luminary Alumni
Luminary Alumni

Hi Sanjeev,

Try like this

Data:

Load empno,

         ename,

         sal, 

          if(sal > 100000, '100000+',

          if(sal > 20000, '20000-100000',

          if(sal >= 1000, '1000-20000', '0-1000'))) as sal_brand

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

i can't send data  i.e i create sample for emp. but i need script part sujeet.

Not applicable
Author

thanks for that sreekanth,but i am asking question if sal table is there and one more table am going to concatenate with same data at that time where can i write salary _band? like above in my script  i need diemention for salary_band not intevels.

sujeetsingh
Master III
Master III

Try using Class() in place of nested If.

jagan
Luminary Alumni
Luminary Alumni

Hi Sanjeev,

Try like this

Data:

Load empno,

         ename,

         sal,

          if(sal > 100000, '100000+',

          if(sal > 20000, '20000-100000',

          if(sal >= 1000, '1000-20000', '0-1000'))) as sal_brand

FROM DataSource1;

Concatenate(Data)

Load empno,

         ename,

         sal,

          if(sal > 100000, '100000+',

          if(sal > 20000, '20000-100000',

          if(sal >= 1000, '1000-20000', '0-1000'))) as sal_brand

FROM DataSource2;

Hope this helps you.

Regards,

Jagan.