Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Meg00
Contributor III
Contributor III

New value only if exists and has changed (slowly changing dimensions))

Hi! I have a salary.qvd file that is filled with new data every month:

SalaryPeriodEmpIDSalaryTypeSalaryDescrAmount
1901101Montly30000 
1901102Sick Leave-800
1901201Monthly38000
19012011Overtime1500
1901307Hourly32000
19013011Overtime1000
1902101Monthly30000
19021011Overtime Hourly800
1902201Monthly38000
19022011Overtime Hourly1400
1902307Hourly32000

The description of the salary type code might change over time. In the example above,  code 011 has changed from "Overtime" to "Overtime Hourly".

I want the end user app to always show the latest description for each code. 

My initial thought is to separate the description from the salary table and use mapping load and apply map, but I'm not sure how to solve to only chande description if it has changed.

Any suggestions?:)

 

Labels (4)
1 Reply
CELAMBARASAN
Partner - Champion
Partner - Champion

I have made a script for you, Firstsortedvalue and separating the Salary desc from the main will make the original table undisturbed. Use the description from SalaryDesc table

Salary:
LOAD SalaryPeriod,
EmpID,
SalaryType,
SalaryDescr as [Original SalaryDescr],
Amount
FROM
[Salary.qvd]
(qvd);

SalaryDesc:
Load SalaryType, FirstSortedValue(DISTINCT [Original SalaryDescr], -1 * SalaryPeriod) as SalaryDescr
Resident Salary
Group by SalaryType;

 

thanks

Celambarasan