This video (https://www.youtube.com/watch?v=tsbnG3tOdR4&feature=emb_logo) shows how to implement alternate state to create two bar plots to compare values in Qlik sense.
I have a follow-up question: for these two bar plots, is it possible to make the y-axis range the same depends on the overall selected values from both alternate states?
I know we can manually set the y-axis limit in Appearance
-> Y-axis
-> Range
. However, since the selected data are from two different alternate states, I don't know how to write an expression to set the range the same for both bar plots.
Comparative Analysis is a way to analyze data based on multiple groups. It is not a comparison between two items such as Company A vs Company B. It is all about you, the user, creating customized groups on demand. For example, you might have seen a graph like this, which is a standard way to compare between companies.
If you want to perform comparative analysis you can use alternate states in Qlik Sense. Alternate states allow you to make different selections on the same dimension, and compare the selections in a single visualization or in two or more visualizations side by side.
It's hard to give a specific answer without knowing what relation you need between the values in the alternate states and the range (happy to elaborate if you can provide more detail).
But the key thing is that you can get to the alternate states using set analysis.
Say that I have two bar charts in an insurance app that both have one dimension 'Claim Type' and one measure 'Average Claim Amount'. The first uses 'State 1' and the second uses 'State 2'.
I want the y-axis range to be bound by the largest bar displaying in either of these two charts.
I could use the following as my y-axis max:
=RangeMax(
Max({'State 1'} Aggr(Avg({'State 1'} [Total Claim Cost]), [Claim Type])),
Max({'State 2'} Aggr(Avg({'State 2'} [Total Claim Cost]), [Claim Type]))
)
The first argument in RangeMax is using an Aggr() function to dynamically create a table of average claim amount per type under the State 1 selection, and taking the max of these (ie. the value of the tallest bar in State 1).
The second argument does the same thing to find the value of the tallest bar in State 2.
Finally, the RangeMax returns the higher of these.
Note that you can use set operators to combine the selections in these states together. Say if I wanted to display some text above the bar charts that displays the value of the largest single claim under the selections in either state. I could use the '+' operator to run my calculation across the union of the states:
=Max({'State 1'+'State 2'} [Total Claim Cost])
The '+' in this context is called a Set Operator, there are other ones available allowing you to combine alternate states in various ways. See here for some more detail and examples: https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/ChartFunctions/SetAnalysis/set-analysis-expressions.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With