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

Dynamic charting

Hi all

I am working on a requirement where we need to create a chart which dynamically adds/removes dimensions or calculations based on selections made. I have seen a sample dynamic charting app but it involves heavy macros and i am not familiar with VB.

What i need to do is, say (Period Count) is my selection.

For Period Count = 5, the chart shall display the following,
ExpressionA = sum({<CURVE_POINT_FACTORS._PERIOD = {'0'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))
1= sum({<CURVE_POINT_FACTORS._PERIOD = {'1'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))
2= sum({<CURVE_POINT_FACTORS._PERIOD = {'1'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))
.....

5= sum({<CURVE_POINT_FACTORS._PERIOD = {'5'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))

For Period Count = 3, the chart shall display the following,
ExpressionA = sum({<CURVE_POINT_FACTORS._PERIOD = {'0'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))
1= sum({<CURVE_POINT_FACTORS._PERIOD = {'1'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))
.....

3= sum({<CURVE_POINT_FACTORS._PERIOD = {'3'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))

error loading image

Sample screenshot above is how the straight table chart should look like but when i select period =5, i am supposed to dynamically see 5 more additional columns IMM1, IMM2, IMM3, IMM4, IMM5.

Can anyone out there help?

Thank you

3 Replies
johnw
Champion III
Champion III

So you're basically just selecting how many of the expressions to show?

Put a conditional show on each expression. For instance, for expression IMM3:

IMM_Period_Count >= 3

But looking at your data, it looks like CURVE_POINT_FACTORS._PERIOD ought to just be selectable and a dimension. Not sure why you're using set analysis and dynamically showing expressions here. It seems like a lot of trouble to do something that should be very simple with another dimension.

Not applicable
Author

Hello John

Thanks for your input. Yes I have thought of using conditional show, however that will require the expression to be created beforehand, and need to know how many periods are there, and then put a conditional show.

If i want to do it dynamically to automatically create the expression, just based on my period count, do i need to create a loop or some sort for i=i to selectedperiod_count, create expression:

IMM($i)sum({<CURVE_POINT_FACTORS._PERIOD = {'$i'}>} (QTY_ORIGINAL * CURVE_POINT_FACTORS._FACTOR))

Is it possible?

johnw
Champion III
Champion III

It should be possible, but it sounds like it would be a fairly complicated macro.

What is preventing you from just adding CURVE_POINT_FACTORS._PERIOD as a dimension?