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: 
Singaravelu_R
Contributor III
Contributor III

Qlik syntax help

Hi Team,

Could you please help to get desired results from my table, the sample data is

Policy policy trans no policy from date source
321 1 01-01-2021 branch 
321 2 01-03-2021 online
321 3 01-04-2021 online
321 1 01-01-2022 online
321 2 01-03-2022 branch 
321 3 01-04-2022 online

 

desired results,

 

    Last year source
souce  count current year branch online
online 2 1 1
branch 1 0 1

 

Please help

Labels (4)
1 Reply
vinieme12
Champion III
Champion III

as below

 

temp:
load Policy,policytransno,date(date#(policyfromdate,'MM-DD-YYYY')) as policyfromdate,year(date#(policyfromdate,'MM-DD-YYYY')) as policyYear,source inline [
Policy,policytransno,policyfromdate,source
321,1,01-01-2021,branch 
321,2,01-03-2021,online
321,3,01-04-2021,online
321,1,01-01-2022,online
321,2,01-03-2022,branch 
321,3,01-04-2022,online
];

left join (temp)
load Policy,policytransno,(policyYear+1) as policyYear,source as LastYearSource
Resident temp;

exit Script;

 

Current Year

Count({<policyYear={"$(=Max(policyYear))"}>}Policy)

 

LastYear Branch

Count({<LastYearSource={'branch'}>}Policy)

 

LastYear Online

Count({<LastYearSource={'online'}>}Policy)

 

 

Capture.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.