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: 
madnanansari
Creator
Creator

Set Analysis - Two or more values in a variable

I have the below formula for Invoice count.

There is a filter bar on the top of the page which has [Year Month] and other filters. If there is no selection in [Year Month]; the below formula shows the information for the current month. (Line No1).

When there is a selection in [Year Month] let say Jan-2017, the formula shows the value for that month. (Line 2).

What changes I have to make in the below formula so that it shows data for multple selection in [Month Year] filter. Let say Jan-2017 and Feb-2017 and more.

If(getselectedcount([Month Year])<1,

Count({$<[YearMonth No]= ,[Year] = ,[Month No]=,[Month Year]=,[Month]=,[MonthID]= {"$(=((Year(Today()) -1)*12) + Num(Month(Today())))"}>} [Invoice No])

,

Count({$<[YearMonth No]= ,[Year] = ,[Month No]=,[MonthID]=,[Month]=,[Month Year]= {"$(=getfieldselections([Month Year]))"}>} [Invoice No])

)

5 Replies
Anonymous
Not applicable

I think it will work if you simplify the second line, give it a try:

...

Count({$<[YearMonth No]= ,[Year] = ,[Month No]=,[MonthID]=,[Month]=>} [Invoice No])

...

madnanansari
Creator
Creator
Author

this brings the count for all. Not what is required.

Anonymous
Not applicable

Saying "second line" I mean your 2nd expression i the if() statement.  The full expression will be:

If(getselectedcount([Month Year])<1,

Count({$<[YearMonth No]= ,[Year] = ,[Month No]=,[Month Year]=,[Month]=,[MonthID]= {"$(=((Year(Today()) -1)*12) + Num(Month(Today())))"}>} [Invoice No])

,

Count({$<[YearMonth No]= ,[Year] = ,[Month No]=,[MonthID]=,[Month]=>} [Invoice No])

)

I also assume that the filter [Year Month] and the field [Month Year] in the if() condition is the same field, just a typo in your opening post (?)

swuehl
MVP
MVP

Why not just use

Count( [Invoice No])


in the else branch of your if() function? What should the set analysis do other than the selections would do anyway?

Anil_Babu_Samineni

Still facing issue, Can you elaborate more. If Jan-2017 selection happened what is the output you want to show?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful