Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

jasmina_karcic
Contributor II

Dynamic values for x-axis

Hi everyone,

How can I make a date dimension for line chart, for dates I want show?


For example: Today is 26.6.


I want a line chart with x axis that has values for last 8 weeks:


8.5., 15.5., 22.5., 29.5., 5.6.,10.6., 19.6., 26.6.


But if I choose from filter for example date 19.6. I want x-axis with values:


2.5., 9.5., 16.5., 23.5., 30.5.,5.6., 12.6., 19.6.


Thanks,


Jasmina

Tags (1)
2 Replies
Ralf_Heukäufer
Contributor III

Re: Dynamic values for x-axis

Hello Jasmina,

to create a Dimension for DATE  (last 60 days)

​In your loadscript:

for i=60 to 0 step -1

let date = date(today()-$(i));

LOAD * Inline [

DATE

$(date)

];

next



In your Charts:

To invert selected Values you must use set analysis in the measure like:

sum({1-$} Value)

but this only shows something if you have set a filter.

you can try something like that as measure to solve that

if(GetSelectedCount(DATE)=0,sum(Value), sum({1-$} Value))

imhappiee
New Contributor III

Re: Dynamic values for x-axis

Hi,

Hope this link helps

https://community.qlik.com/thread/91233

Anand

Community Browser