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: 
cdhdata
Contributor
Contributor

Flag to indicate customer switch from one health plan to another

Hi there!

I'm attempting to build a flag in the load script that would show whether a member has the same health plan product in current year as they did in previous year. If they have switched products I want to indicate this with a 'Y.'

See example below:

ID Year Product Switch_Flag
ABC123 2023 Commercial HMO N
ABC123 2024 Commercial HMO N
DEF456 2023 Commercial HMO N
DEF456 2024 Commercial Non-HMO (UBI) Y
GHI789 2023 Medicare Individual N
GHI789 2024 Child Health Plus Y
JKL012 2023 Medicare Individual N
JKL012 2024 Medicare Individual N

 

Any and all help is appreciated! Thanks!

Labels (3)
1 Solution

Accepted Solutions
David_Friend
Support
Support

@cdhdata I plugged your question into Chat GPT and it suggested using a combination of preceding loads and resident loads, I won't copy/past the answer here since that would falsely make me look like an expert on this 🙂  But suggest doing it yourself as well may be helpful.

View solution in original post

3 Replies
MatheusC
Specialist II
Specialist II

Hi, @cdhdata 

Work with the peek function to achieve this result.

https://help.qlik.com/en-US/sense/February2024/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecor...

MatheusC_0-1715888267304.png

 

MatheusC_1-1715888284251.png


Regarts, Matheus



Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
David_Friend
Support
Support

@cdhdata I plugged your question into Chat GPT and it suggested using a combination of preceding loads and resident loads, I won't copy/past the answer here since that would falsely make me look like an expert on this 🙂  But suggest doing it yourself as well may be helpful.

Vegar
MVP
MVP

This will work, but  ensure that the data is loaded in correct order. That is by ID and  YEAR, if the sort order is shuffled then it won't work. You can use ORDER BY ID, YEAR to do this.