Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
lawrenceiow
Creator II
Creator II

Axes, Scale - specify automatic using expression.

Dear Community,

I have created a Bar chart with the following expression in the Static Max box.

  if(GetSelectedCount(ReportingDate)=1,Ceil(vMaxAtts,10),1000)

The value of vMaxAtts was determined in the Script and represents the maximum value per reporting date over the entire date range. The expression in the chart is sum(CountAtts) per timeband during the day.

What I want to happen is:

when the user selects one ReportingDate then the Static Max should be fixed - I am happy with this part of the expression.

when the user selects more than one (or does not make a selection) the Static Max should function as it does without an expression, i.e. Automatic - I don't know how to do this, I have entered 1000 into the expression for now.

Thank you for any help with this.

1 Solution

Accepted Solutions
Not applicable

This is an interesting topic.

What happens if you use :

  if(GetSelectedCount(ReportingDate)=1,Ceil(vMaxAtts,10))


You can also try:

  if(GetSelectedCount(ReportingDate)=1,Ceil(vMaxAtts,10),Ceil(Max(Aggr(sum(CountAtts),Dimension)),2))


Hope it helps

Thanks

AJ

View solution in original post

2 Replies
Not applicable

This is an interesting topic.

What happens if you use :

  if(GetSelectedCount(ReportingDate)=1,Ceil(vMaxAtts,10))


You can also try:

  if(GetSelectedCount(ReportingDate)=1,Ceil(vMaxAtts,10),Ceil(Max(Aggr(sum(CountAtts),Dimension)),2))


Hope it helps

Thanks

AJ

lawrenceiow
Creator II
Creator II
Author

Excellent, thanks for our answers AJ.

Your second suggestion is the kind of answer I was looking for and this worked, thank you.

In your first suggestion I thought you'd mistakenly missed out the FALSE part of the IF statement but I tried it anyway and that worked too!

I also tried if(GetSelectedCount(ReportingDate)=1,Ceil(vMaxAtts,10),) which also worked.

So, the best answer for me is going to be your first suggestion - i.e. nothing specified for the FALSE part.

Thanks again.