Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anuhyak1
Creator
Creator

How to set up Dynamic yaxis in control charts especially in Line chart

I have Line chart which reports official values (Y Axis) based on Reporting year on (x Axis).
Below is the expression for eOfficial 

Only({<[CRS Version]=, Flg_National={0}>} [Report Year Percent]).

I have two variables tAxis = 1 Traditional and tAxis =2 for varying. The yaxis in the line chart has to be changed dynamically based on the selection made in the variable 


Here is the expression setup for axes but varying is not changing and showing flat line. Could you please help me with the min and max expression for axis and how this vary.

if (
Pick($(tAxis),
$2(Aggr(Only({<[CRS Version]=>} [Report Year Percent]),[Area Name])),
if('$2'='Min', $2(Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]), [CRS Reporting Year])),
$2(Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]), [CRS Reporting Year]))))
<0, 0,
Pick($(tAxis),
$2(Aggr(Only({<[CRS Version]=>} [Report Year Percent]),[Area Name])),
if('$2'='Min', $2(Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]), [CRS Reporting Year])),
$2(Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]), [CRS Reporting Year])))
))

Labels (6)
2 Replies
Aasir
Creator III
Creator III

Try this

=if(
$(tAxis)='Traditional',
Aggr(Only({<[CRS Version]=>} [Report Year Percent]),[Area Name]),
if(
$(tAxis)='Varying',
Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]),
[CRS Reporting Year]
),
if(
$(tAxis)='Min',
Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]),
[CRS Reporting Year]
),
if(
$(tAxis)='Max',
Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]),
[CRS Reporting Year]
),
0 // Default value if none of the conditions match
)
)
)
)

Anuhyak1
Creator
Creator
Author


@Aasir wrote:

Try this

=if(
$(tAxis)='Traditional',
Aggr(Only({<[CRS Version]=>} [Report Year Percent]),[Area Name]),
if(
$(tAxis)='Varying',
Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]),
[CRS Reporting Year]
),
if(
$(tAxis)='Min',
Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]),
[CRS Reporting Year]
),
if(
$(tAxis)='Max',
Aggr(
Only({<[Area Name]={'$(=$(vArea_Pick($1)))'},[CRS Version]=>} [Report Year Percent]),
[CRS Reporting Year]
),
0 // Default value if none of the conditions match
)
)
)
)


How to pass these values in a variable with parameters in line chart axis?