Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
viveksingh
Creator III
Creator III

update segment based on a period

Hi Every one,

I have data with Agent, Segment, Period. Now I want to insert another column to table based on a period.

Data is like below:

data_agent.PNG

Expecting like below. It should take Max Year(2018) and March as reference and update segment untill 2018 March. And the reset should not update.

Agent_update.PNG

 

Please advise on this.

Labels (1)
5 Replies
JordyWegman
Partner
Partner

Hi Viveksingh,

How is March 2018 determined? Based on the current month of the previous year? Should next month everything be updated until April 2018?

You can create this by doing the following:

Create a mapping table with the new information and use this in combination with an if statement like: If(Period<=$(vCurrentPeriod),Applymap('YourCreatedMappingTable)',Agent & '|' & Segment,0),OldSegment) as New Segment.

Jordy

Climber

Work smarter, not harder
viveksingh
Creator III
Creator III
Author

March is the fixed month and 2018 is max Year from the available data.  Data will come on monthly basis. Once we receive March data we have to take Max Year march as reference and should update segment until March Max Year, also, It should not update from April Max Year to Feb next year.

 

viveksingh
Creator III
Creator III
Author

Any inputs on this please
JordyWegman
Partner
Partner

You should consider the approach I explained earlier. This should work. Do you need some help with this code?

Jordy

Climber

Work smarter, not harder
viveksingh
Creator III
Creator III
Author

I’m facing issues in getting Max year and month as March in vCurrentPeriod.
I got the max year in one variable and month number in another variable and I created one more variable combining the max year and march. When I use in if condition, it is not working as expected