Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic Month as calculate dimension

Hello,

I was stuck with one problem, I don't know how to create dynamic calculate dimension. Like you see image, I want to create dimension based od selected date:

the expression for Month = Date={">$(=Date(Max(Date-30)))<=$(=Max(Date))"}

the expression for Month -1 = Date={">$(=Date(Max(Date-60)))<=$(=Date(Max(Date-30)))"}

the expression for Month -2 = Date={">$(=Date(Max(Date-90)))<=$(=Date(Max(Date-60)))"}

the expression for Month -3 = Date={">$(=Date(Max(Date-120)))<=$(=Date(Max(Date-90)))"}

the expression for Month -4 = Date={">$(=Date(Max(Date-150)))<=$(=Date(Max(Date-120)))"}

the expression for Month -5 = Date={">$(=Date(Max(Date-180)))<=$(=Date(Max(Date-150)))"}


Is it possible to create a dynamic month dimension?

Chart.png

1 Solution

Accepted Solutions
kamal_sanguri
Specialist
Specialist

Also, if the previous solution doesn't work for you try this method.

First Uncheck the Show Legend check box to turn off the 'X' axis labels on chart.

Capture.PNG

Then, Add text which will be your labels for 'X' axis.

Capture.PNG

the newly added text would appear on TOP LEFT side of your chart

Capture.PNG

Now click anywhere on chart to activate it and then press CTRL + SHIFT and you will see a red line around different objects in text

Capture.PNG

Now, Keep pressing CTRL + SHIFT and now you can drag this text box anywhere you want. You can then add more labels and put them at right place using this method.

Capture.PNG

View solution in original post

7 Replies
sunny_talwar

May be this

If(Date > (Max(TOTAL Date) - 30) and Date <= (Max(TOTAL Date)), Dual('Month', 1),

If(Date > (Max(TOTAL Date) - 60) and Date <= (Max(TOTAL Date) - 30), Dual('Month - 1', 2),

If(Date > (Max(TOTAL Date) - 90) and Date <= (Max(TOTAL Date) - 60), Dual('Month - 2', 3),

If(Date > (Max(TOTAL Date) - 120) and Date <= (Max(TOTAL Date) - 90), Dual('Month - 3', 4),

If(Date > (Max(TOTAL Date) - 150) and Date <= (Max(TOTAL Date) - 120), Dual('Month - 4', 5),

If(Date > (Max(TOTAL Date) - 180) and Date <= (Max(TOTAL Date) - 150), Dual('Month - 5', 6)))))))

Anonymous
Not applicable
Author

Yes, I have now "special dimension" but bars on the graph are not aligned to the middle. On the graph you see 7 expressions, how to move bars on middle of dimension?

chart2.png

Regards

Jacek.

kamal_sanguri
Specialist
Specialist

Try changing the orientation of 'X' axis label this way.

Capture.PNG

Anonymous
Not applicable
Author

Hello,

Still from a visual point of view it looks bad. Label is not under bar and the line is not from beginning to end of the chart.

chart3.png

Regards

Jacek.

kamal_sanguri
Specialist
Specialist

Also, if the previous solution doesn't work for you try this method.

First Uncheck the Show Legend check box to turn off the 'X' axis labels on chart.

Capture.PNG

Then, Add text which will be your labels for 'X' axis.

Capture.PNG

the newly added text would appear on TOP LEFT side of your chart

Capture.PNG

Now click anywhere on chart to activate it and then press CTRL + SHIFT and you will see a red line around different objects in text

Capture.PNG

Now, Keep pressing CTRL + SHIFT and now you can drag this text box anywhere you want. You can then add more labels and put them at right place using this method.

Capture.PNG

Not applicable
Author

Check if changing the style from grouped to stacked helps.

Cheers,

rohan

Anonymous
Not applicable
Author

Super trick. Thank you for your help. Big plus for you and Sunny.

Final effect:chart4.png

Regards

Jacek.