Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ZoeM
Specialist
Specialist

Avg of values if no selection made

Hi!

Should be simpler than I am thinking right?

I have a data set and I would like the average value rating shown (G,Y,R) to be the average of the current year available if no year selection is made. How can I layer in [VPP Year]={$(=Date(Today(),'YYYY'))} into the below If Statement? 

 

=if(Avg([#of Days Post VPP])<8,'G',

if(Avg([#of Days Post VPP])<15,'Y',

if(Avg([#of Days Post VPP])>14,'R'

,'')))

 

Thanks!

Labels (2)
1 Solution

Accepted Solutions
ZoeM
Specialist
Specialist
Author

I found a workaround 😃

Used Set Analysis to combine the current year parameter. 

=if(( num(If(IsNull(GetFieldSelections([VPP Year])),


Sum({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}

Aggr(Only({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}[Gateways]),

 

Sum({$<Gateways={'FEC'}>}

Aggr(Only({$<Gateways={'FEC'}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'}>}[Gateways])),'#0.0'))<8,'G',



if(( num(If(IsNull(GetFieldSelections([VPP Year])),


Sum({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}

Aggr(Only({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}[Gateways]),

 

Sum({$<Gateways={'FEC'}>}

Aggr(Only({$<Gateways={'FEC'}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'}>}[Gateways])),'#0.0'))<15,'Y',


if(( num(If(IsNull(GetFieldSelections([VPP Year])),


Sum({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}

Aggr(Only({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}[Gateways]),

 

Sum({$<Gateways={'FEC'}>}

Aggr(Only({$<Gateways={'FEC'}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'}>}[Gateways])),'#0.0'))>14,'R',


'')))

View solution in original post

1 Reply
ZoeM
Specialist
Specialist
Author

I found a workaround 😃

Used Set Analysis to combine the current year parameter. 

=if(( num(If(IsNull(GetFieldSelections([VPP Year])),


Sum({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}

Aggr(Only({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}[Gateways]),

 

Sum({$<Gateways={'FEC'}>}

Aggr(Only({$<Gateways={'FEC'}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'}>}[Gateways])),'#0.0'))<8,'G',



if(( num(If(IsNull(GetFieldSelections([VPP Year])),


Sum({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}

Aggr(Only({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}[Gateways]),

 

Sum({$<Gateways={'FEC'}>}

Aggr(Only({$<Gateways={'FEC'}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'}>}[Gateways])),'#0.0'))<15,'Y',


if(( num(If(IsNull(GetFieldSelections([VPP Year])),


Sum({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}

Aggr(Only({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'},[VPP Year]={$(=Date(Today(),'YYYY'))}>}[Gateways]),

 

Sum({$<Gateways={'FEC'}>}

Aggr(Only({$<Gateways={'FEC'}>} [#of Days Post VPP]), Gateways, [MY Program]))/

Count({$<Gateways={'FEC'}>}[Gateways])),'#0.0'))>14,'R',


'')))