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: 
Not applicable

Hide Trend line in combo chart when no selections are made?

Hi all,

I need to hide the trend line that was created using linest functions when no selections are made. For example i have a combo chart with Month as it's dimension, and sum(Purchase) as one measure and Avg(Unit price) as other measure. When selections are made in Product column I need to show the trend line other wise just hide that line .

How to do this ?

any help will be appreaciated?

Note: I am able to show the trend line without any selections. Now i need to hide that and show it when I made some selections in product column.

Thank you

line chart.png

11 Replies
Chanty4u
MVP
MVP

Not applicable
Author

Thanks for the reply.

It's not a reference line but a trend line.

He goal is show when the selection is made on product column, it should show trend line other wise just bars as in bar chart.

Chanty4u
MVP
MVP

u can create a text box over chart and apply  show hide  and layer shud be in top

Gysbert_Wassenaar

Make a copy of that expression without the trend line. Then use the conditional display option for both expressions to show/hide the expression (and the trendline for the expression that has one) with something like =len(GetCurrentSelections()) and =NOT len(GetCurrentSelections()) as conditional expressions.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Wassenaar,

I think i don't get, Make a copy of that expression??

My trend line expression is

LINEST_M(total aggr(avg([WA Price]),InvoicedMonth),InvoicedMonth)*InvoicedMonth+

LINEST_B(total aggr(avg([WA Price]),InvoicedMonth),InvoicedMonth)

And another measure is straight: sum(Price).

I think am clear with my requirement!!

Not applicable
Author

Chanty, I tried it but it's not showing any effect when I apply the expression they discussed. By the way, I am doing it Qlik sense.

Gysbert_Wassenaar

Oh, I thought you had enabled a trend line option on the bar expression. If the trend line is another chart expressions then you can use its conditional expression to show/hide it as needed with =Len(GetCurrentSelections()). Or if you only want to check selections in the Product field then =GetSelectedCount(Product)


talk is cheap, supply exceeds demand
Not applicable
Author

Wassenaar,

If I am correct, we don't have any conditional expressions in qlik sense. So, I guess we have to write on the expression that we are using for  trend line. Am I correct?