Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
david_pearson
New Contributor III

Set Expressions

i have a few variable QS Buttons to control several KPI outputs on my page. What i want to display is the volume/Count of CLAIMNUM  for the current calendar quarter when variable button vYEARS=2 is selected. I have this working for vYears=1 and 3 for current month and year but i'm struggling to get quarter view to work. example code in bold below. sorry cant share data as sensitive.  this will be based on a calendar date. i then plan on extending this to have a comparison on current quarter and previous. Can you please help

 

if(vStatus=1,
if(vYears=1,Count({< LOB={'Motor'}, MonthYear = {"$(=Date(AddMonths(today(), -0), 'M-YYYY'))"}>} CLAIMNUM),


if(vYears=2,Count({$< LOB={'Motor'},[NOTIFIEDDATE.autoCalendar.Date] ={"=$(=(Date(Addmonths(QuarterStart([NOTIFIEDDATE.autoCalendar.Date]),-0),'DD-MM'YYYY')))"},[NOTIFIEDDATE.autoCalendar.Date]=>}CLAIMNUM),

if(vYears=3,Count({< LOB={'Motor'}, NOTYEAR = {"$(=max(NOTYEAR))"}>} CLAIMNUM)))),

3 Replies
MVP & Luminary
MVP & Luminary

Re: Set Expressions

Maybe like this:

if(vYears=2,Count({$< LOB={'Motor'},[NOTIFIEDDATE] ={">=$(=Date(QuarterStart([NOTIFIEDDATE]),'DD-MM-YYYY'))<=$(=Date(QuarterEnd([NOTIFIEDDATE]),'DD-MM-YYYY'))"},[NOTIFIEDDATE]=>}CLAIMNUM),

 


talk is cheap, supply exceeds demand
david_pearson
New Contributor III

Re: Set Expressions

thanks for this. it does give me a return however this is returning a count of everything based on vYears=2,Count({$< LOB={'Motor'}. it hasn't restricted it to this quarter (Oct18-Dec18). Any other thoughts? full code below and ive attached a screen shot too

//Clears Claim Status Variable Button and Time View Variable Buttons
if(vStatus=1,
if(vYears=1,Count({< LOB={'Motor'}, MonthYear = {"$(=Date(AddMonths(today(), -0), 'M-YYYY'))"}>} CLAIMNUM),

if(vYears=2,Count({$< LOB={'Motor'},[NOTIFIEDDATE] ={">=$(=(Date(QuarterStart([NOTIFIEDDATE]),
'DD-MM-YYYY'))<=$(=(Date(QuarterEnd([NOTIFIEDDATE]),'DD-MM-YYYY'))"},[NOTIFIEDDATE]=>}CLAIMNUM),

if(vYears=3,Count({< LOB={'Motor'}, NOTYEAR = {"$(=max(NOTYEAR))"}>} CLAIMNUM)))))),


MVP & Luminary
MVP & Luminary

Re: Set Expressions

If your NOTIFIEDDATE field does not have the DD-MM-YYYY format then change the format in the expression to the correct format. And try removing the Date() function altogether or replace it with the num function.

talk is cheap, supply exceeds demand