Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Stars
Creator
Creator

Wildcard in If Statement

I'm doing something wrong when I try to nest wildcard within my if statement.

When I use this equation in my bar graph, everything is fine.  Both questions are numeric.

=(Avg({1<Year = {$(=Max(num#(Year ,'####')))}>} Aggr(
if(Sum({1<Question={"BillValue*"}>}Response)>0,
Sum({1<Question={"Financial*"}>}Response),null())
,YearID,Year)))

 

But when I try to use a wildcard, I get a blank graph.  The question I'm trying to look at with the wildcard is a TEXT response and I don't think I'm addressing it correctly, but I don't know what's wrong.

=(Avg({1<Year = {$(=Max(num#(Year ,'####')))}>} Aggr(
if(WildMatch({Question={"PaymentType*"}>}Response,"*Credit*"),
Sum({1<Question={"Financial*"}>}Response),null())
,YearID,Year)))

 

Any tips to correct my equation syntax would be appreciated.  Thank you!

4 Replies
mikaelsc
Specialist
Specialist

wilmatch is not an aggregation function --> no set analysis. 

(also wildmatch compares text --> '*credit*')... 

 

also... your expression looks complicated... what are you trying to do? 

 

Stars
Creator
Creator
Author

Ohhh, so can I not have a wildmatch inside an aggr function?

I am trying to compare text - I want to find only values that include "credit", however people reply differently - some write "creditcards" some write "credit cards" some write "credit/debit", etc, so I want to capture anyone who uses credit of any sort as a payment method.

The expression is crazy complicated, right?!  There might be a way to simplify, but I don't know what it is.  I have data coming in and I need to pull out data, by year, by company, for specific responses and then use that data.  That's why it's so complex.  And it works, so I haven't worried about cleaning it up at all.  But now I can't get the wildmatch part to work....  But maybe it's just not allowed inside the aggr function....  Maybe I need to put it before the aggr function?  But still in my if statement somehow?  

Stars
Creator
Creator
Author

I tried moving the wildmatch, but neither of these worked yet....

 

=if(WildMatch({1<Question={"PaymentType*"}>}Response,"Credit*"),
(Avg({1<Year = {$(=Max(num#(Year ,'####')))}>} Aggr(
Sum({1<Question={"Financial*"}>}Response)
,YearID,Year))),null())

 

=Avg({1<Year = {$(=Max(num#(Year ,'####')))}>}
if(WildMatch({1<Question={"PaymentType*"}>}Response,"Credit*"),
(Aggr(Sum({1<Question={"Financial*"}>}Response)
,YearID,Year)),null())

mikaelsc
Specialist
Specialist

wildmatch is not an aggregation function, 

sum, avg, min, max, only, are aggregation functions

aggr is.. not completely an aggregation function (because it returns an array of values)... 

Set analysis can only be used in aggregation functions and aggr

 

why not simply something like

avg({<Question={"*Financial*"},Question={"PaymentType*"}, Response={"Credit*"} >}Response)

 

(adapt in fn of your exact need... )