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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rename of Field Value where it more than once

Hi

I have the following table below where Employees has taken leave in a month. So where an Employee has taken more than one type of Leave (those Employees highlighted in blue), I want the value for the  Type of Leave to change to 'Combination'.

How do accomplish this.  I want to do this in the back end.

Kind regards

Nayan

   

EmployeeType of LeaveLeave Days Taken
2216Sick Leave5
2216Annual Leave Commutation20
162345Annual Leave1
1761064Annual Leave1
1761064Annual Leave Commutation10
1796690Annual Leave1
1960393Family Responsibility Leave1
1986821Annual Leave1
2021048Annual Leave3
2060892Sick Leave1
2081350Sick Leave4
2081857Sick Leave2
2125943Annual Leave1
2125943Annual Leave Commutation7
2126036Family Responsibility Leave1
2150506Annual Leave Commutation7
2150875Annual Leave1
2150875Sick Leave3
1 Solution

Accepted Solutions
sunny_talwar

Check this

Table:

LOAD * INLINE [

    Employee, Type of Leave, Leave Days Taken

    2216, Sick Leave, 5

    2216, Annual Leave Commutation, 20

    162345, Annual Leave, 1

    1761064, Annual Leave, 1

    1761064, Annual Leave Commutation, 10

    1796690, Annual Leave, 1

    1960393, Family Responsibility Leave, 1

    1986821, Annual Leave, 1

    2021048, Annual Leave, 3

    2060892, Sick Leave, 1

    2081350, Sick Leave, 4

    2081857, Sick Leave, 2

    2125943, Annual Leave, 1

    2125943, Annual Leave Commutation, 7

    2126036, Family Responsibility Leave, 1

    2150506, Annual Leave Commutation, 7

    2150875, Annual Leave, 1

    2150875, Sick Leave, 3

];

Left Join (Table)

LOAD Employee,

Count(DISTINCT [Type of Leave]) as Count

Resident Table

Group By Employee;

FinalTable:

LOAD *,

If(Count = 2, 'Combination', [Type of Leave]) as [New Type of Leave]

Resident Table;

DROP Table Table;

Capture.PNG

View solution in original post

2 Replies
sunny_talwar

Check this

Table:

LOAD * INLINE [

    Employee, Type of Leave, Leave Days Taken

    2216, Sick Leave, 5

    2216, Annual Leave Commutation, 20

    162345, Annual Leave, 1

    1761064, Annual Leave, 1

    1761064, Annual Leave Commutation, 10

    1796690, Annual Leave, 1

    1960393, Family Responsibility Leave, 1

    1986821, Annual Leave, 1

    2021048, Annual Leave, 3

    2060892, Sick Leave, 1

    2081350, Sick Leave, 4

    2081857, Sick Leave, 2

    2125943, Annual Leave, 1

    2125943, Annual Leave Commutation, 7

    2126036, Family Responsibility Leave, 1

    2150506, Annual Leave Commutation, 7

    2150875, Annual Leave, 1

    2150875, Sick Leave, 3

];

Left Join (Table)

LOAD Employee,

Count(DISTINCT [Type of Leave]) as Count

Resident Table

Group By Employee;

FinalTable:

LOAD *,

If(Count = 2, 'Combination', [Type of Leave]) as [New Type of Leave]

Resident Table;

DROP Table Table;

Capture.PNG

Anonymous
Not applicable
Author

Thank you Sunny.  It worked.

Kind regards

Nayan