Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Guys,
i have this table:
ID_1 | ID_2 | Date | Name |
Ix2 | 10001 | 01.01.2021 | Jane McKenzie |
Ix2 | 10001 | 01.01.2021 | |
Ix3 | 10001 | 02.01.2021 | |
Ix3 | 10002 | 02.01.2021 | |
Ix3 | 10003 | 02.01.2021 | Peter Smith |
Ix3 | 10003 | 02.01.2021 | |
Ix2 | 10004 | 03.01.2021 | Max Miller |
Ix2 | 10004 | 03.01.2021 | |
Ix2 | 10004 | 03.01.2021 |
Now i want the column Name to be filled,...
....if value in column ID_1 is 'Ix2' and....
....if the field contents of columns ID_2 and Date occur more than once and a value is found in column Name, then the name should be entered wherever the criteria from column ID_2 and Date are the same....
The final result *bold* should look like this:
ID_1 | ID_2 | Date | Name |
Ix2 | 10001 | 01.01.2021 | Jane McKenzie |
Ix2 | 10001 | 01.01.2021 | Jane McKenzie |
Ix3 | 10001 | 02.01.2021 | |
Ix3 | 10002 | 02.01.2021 | |
Ix3 | 10003 | 02.01.2021 | Peter Smith |
Ix3 | 10003 | 02.01.2021 | |
Ix2 | 10004 | 03.01.2021 | Max Miller |
Ix2 | 10004 | 03.01.2021 | Max Miller |
Ix2 | 10004 | 03.01.2021 | Max Miller |
Do you have any ideas for the script?
Thanks !!
You can do do this using peek (with no parameter = last loaded record) and sorting of the table appropriately. This way you can pull the previous row name and "fill" down:
source_data:
LOAD
*
from https://community.qlik.com/t5/New-to-Qlik-Sense/Filling-columns-depending-on-criteria/td-p/1837960
//https://community.qlik.com/t5/QlikView-App-Dev/PivotTable-Diagram-does-not-show-dimension-with-value...
(html, utf8, embedded labels, table is @1)
;
rename field Name to source_name;
data_fillname:
load *
,If(len(trim(source_name))=0 and ID_1 = 'Ix2', If((ID_1=peek(ID_1)) and (ID_2=peek(ID_2)) and (Date=peek(Date)), peek(Name)), source_name) as Name
resident source_data
order by Date asc, ID_2 asc, ID_1 asc
;
drop table source_data;
drop field source_name;
exit script;