Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
zyn
Contributor II
Contributor II

Dynamic Y Axis in line chart

Hi,

i want to change the value of my y axis dynamically as different measures have different values,

i have created a field on backend that has only dates for each thursday as user wants to show values by thursday,

now i am using this expression in measure:

sum({<DITDATE= {">=$(=(addmonths(max(DITDATE),-1)))<=$(=(date(Max(DITDATE))))"},Table_Flag = {'JAT'}>}Volume_Count)

also i have threshold values which i added in reference line:

sum({<DITDATE>}ThresholdGreen)

sum({<DITDATE>}ThresholdRED)

->Now for y axis i have written:

if(sum({<DITDATE>}ThresholdRED)>sum({<DITDATE>}ThresholdGreen),sum({<DITDATE>}ThresholdRED)+10,sum({<DITDATE>}ThresholdGreen)+10)

 

but if the value of any thursday is greater then the threshold the line is going above the chart, also i used the measure expression in y axis to compare the threshold value with the measure but that is taking max value for the selected date where as my dimension is across 5 weeks so there are values greater then that, can someone suggest a fix for this please!

3 Replies
Kaushik2020
Creator III
Creator III

Could you please share a sample dataset in excel or a qvf file with some screenshots. we can look for a possible solution further.

zyn
Contributor II
Contributor II
Author

@Kaushik2020 
Here is a sample data i have created for same scenario,

Test:
load *,
date(DIT,'DD/MM/YYYY') as DITDATE;
load * inline [
Measure,DIT,Volume
'>3days',06/01/2025,1
'>3days',06/01/2025,1
'>3days',06/01/2025,1
'>3days',06/01/2025,1
'>3days',06/02/2025,1
'>3days',06/02/2025,1
'>3days',06/02/2025,1
'>3days',06/03/2025,1
'>3days',06/03/2025,1
'>3days',06/03/2025,1
'>3days',06/03/2025,1
'>3days',06/03/2025,1
'>3days',06/03/2025,1
'>3days',06/03/2025,1
'>3days',06/04/2025,1
'>3days',06/05/2025,1
'>3days',06/05/2025,1
'>3days',06/05/2025,1
'>3days',06/05/2025,1
];

I am using this expression in a line chart:

Sum({<DITDATE= {">=$(=(date(Max(DITDATE)-2,'DD/MM/YYYY')))<=$(=(date(Max(DITDATE),'DD/MM/YYYY')))"}>}Volume)

so if you select date: 05/06/2025 you will get this result:

zyn_0-1754572904273.png

Now in a kpi i want to show the number 7 as it is the max of that range, but I am not able to achieve it

let me know if any other clarification needed.

Thanks

 

marcus_sommer

Looked that you need an approach like:

max({ Set } TOTAL <MyDim> aggr(NODISTINCT { Set } sum({ Set } MyField), MyDim))

The Set may not mandatory needed at each aggregation-level and similar also the TOTAL and/or the NODISTINCT ... just applying it step by step and maybe some ones in parallel in the table will show what happens and what will be then useful in the line-chart.