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

Chart Accumulation based on selection

Hi all,

Please see attached an example document. There you will see that there are 2 flags and a simple straight table.

What i want to do is select the flags together. When the 2 flags are selected i need both sets of products to appear in the chart. At the moment the intersection of the 2 flags is showing up in the charts when they are selected. I need those flags to accumulate onto each other.

Please help.

Just to try explain again. When Flag1 and Flag2 are selected. I need ProductCodes 1-6 to appear in the chart with their relative Sales and Quantity figures.

Any suggestions?

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached example.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached example.


talk is cheap, supply exceeds demand
stevelord
Specialist
Specialist

I only have personal version QV so can't see your file, but I think I understand.

You might try a set analysis solution with alternate states to let the chart show the two list box selections independantly of each other.

To do this, you'd create two alternate states (State 1 and State 2), then assign one state to flag 1 and the other to flag 2.

Then in your straight table, you'd make one expression that has {State 1} as the first bit in the () and {State 2} in the same expression used again for a second column.

The result should be one column responding to {State 1} and the other to {State 2}

Your dimensions might work the same way i.e. =({State 1} Sales), =({State 1} Quantity),=({State 2} Sales), =({State 2} Quantity)  (I've done this with expressions and bar charts, but not dimensions and straight charts.  It seems like it should work okay though.)

Alternatively, you might be able to make flag 1 and flag 2 into a single flag field in the script.

if(Flag 1, Dual('Flag 1', 1),

if(Flag 2, Dual('Flag 2', 2) as Flag

Then you'd have a single field on your chart for both flags and you could select one or the other or both, and the chart totals could total that as a single field.  (And you could still leave separate flag 1 and flag 2 fields if you want to use those separetly somewhere else.)

Not applicable
Author

Thanks very much, much appreciated.

Not applicable
Author

Sorry Gysbert i have one more query for you.

When there is Set Analysis involved i try this:

sum({$(vFlag1)+$(vFlag2)<Month=, Year=, YearMonth = {"$(=Date(Addmonths(Date#(YearMonth,'YYYYMM'),-2),'YYYYMM'))"}>} Sales)

it only brings back the value of Flag1 if it is selected. if Flag1 and Flag2 are both selected null is returned. How would you add this 'expansion' into a set analysis piece?

Thanks again.