Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

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
sureshqv
Esteemed Contributor III

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

Not applicable

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

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.

sureshqv
Esteemed Contributor III

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

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

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

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
sureshqv
Esteemed Contributor III

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

Not applicable

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

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

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

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.

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

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

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

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?