Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if nothing selected

HI

I have a variable with two parameters, e.g. use 6 and 12 month back, and I use MonthSerial (you know max bla bla, I dont think it matters for this).

When I select in eg a year in the master calendar it works fine, but when all is clear, it does not know from where to count.

So I need to tell it that when nothing is selected take the max year.

What is the easiest way do to this?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Well, there you go. Embedding an aggregation function within an aggregation function will not work (in general, e.g without using advanced aggregation).

If you cleared all selection, what does your variable return? I would assume it's still working beacuse you are applying a ranges selection for MonthSerial based on Max(MonthSerial).

View solution in original post

14 Replies
Anonymous
Not applicable
Author

Would the GetPossibleCount() function help you ?

alexandros17
Partner - Champion III
Partner - Champion III

use the getselectedcount() function to know if a field is selected so write something like:

If(getselectedcount(myField)=0, Max(myField), getselectedfield(myField))

swuehl
MVP
MVP

Well, I assume the max() function will also be your friend here.

But why don't you just post your variable definition and other relevant information, this would make it much easier to help.

sunny_talwar

I would used Max(Year) regardless of selection or no selection, because when there is no selection made it will choose the maximum year and when a selection is made it will choose the max from the available years. (Unless you don't want the max year when a selection is made, Max(Year) should work.

Best,

Sunny

Not applicable
Author

Well I tried this:

if(getselectedcount(Year)<1,Round(sum({<MonthSerial={"=Max(MonthSerial)"}>} ($(Interval(6,12))))),Round($(Interval(6,12))))

it does not work.  It should be able to translate from year to monthserial?

Not applicable
Author

thx but I think getselectedcount() is better as suggested?

swuehl
MVP
MVP

What is the definition of variable Interval(x,y)?

Seems like you included it into an aggregation, which will not work if it's an aggregation itself.

Not applicable
Author

hmm, well yes that is probaly true, it works when I select.

The varaible is longer, I cannot show all, but it starts like this: ...((Sum({$<YearMonth,Year,Month,,MonthSerial={"<=$(=Max(MonthSerial)-$1)>=$(=Max(MonthSerial)-$2)"},...

so there you have the parameters.

swuehl
MVP
MVP

Well, there you go. Embedding an aggregation function within an aggregation function will not work (in general, e.g without using advanced aggregation).

If you cleared all selection, what does your variable return? I would assume it's still working beacuse you are applying a ranges selection for MonthSerial based on Max(MonthSerial).