Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Perform functions on one block/set of data till the value changes

Hello all,

This would be on Qlik Sense.

I have 2 columns in a table:

ID          Sal

002       879

002     

002       876

003     

003       543

003

Now I'd like a result which will replace all the values of "Sal", based on the column ID. the result should look like this:

ID          Sal

002       879

002       879 

002       876

003       543

003       543

003       543

i.e., based on the key column, it would replace the previous "Sal" value for all blank "Sal" values for that ID till it encounters a non blank value. I would like this to happen in the data load editor.

Kindly provide your inputs on this.

Thanks in advance.

5 Replies
dplr-rn
Partner - Master III
Partner - Master III

you can use previous function something like

if(Sal="",previous(Sal), Sal)

Anonymous
Not applicable
Author

Thanks, But how'd I group it based on ID?

dplr-rn
Partner - Master III
Partner - Master III

if i understand your statement correctly... define Sort order , id and Sal so that id's are grouped together and a non null sal comes first

Anonymous
Not applicable
Author

Hi Dilip,

It is difficult to group the values in an order where non null sal comes first in my actual problem as it has to be sorted on a time series basis. That is the point where I'm stuck,

Using the previous function I was successful in achieving one iteration. however in case of multiple iterations, a looping would be required. Not so confident on how the loops are used.

your inputs on similar lines would be appreciated.

Thanks in advance.

dplr-rn
Partner - Master III
Partner - Master III

i think i understand the problem.

think it might need soemthing a bit more convoluted. not sure i can help without access to the app.

very very (possibly unnecessarily) complicated way i can think off not knowing your app

e.g. you load the data into a temp table and which conforms to the logic you want for the first non null value. create a map from this. use that for the actual table load