Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jdy_isl
Contributor
Contributor

complex charting - a monthly bar chart with the current year's target line and bars for previous years

hello!

I'm trying to create a monthly bar chart with the current year's target line and bars for previous years. Is this doable in qlik sense?

thanks!

jdy_isl_0-1727050534429.png

 

Labels (1)
3 Replies
Kushal_Chawda

@jdy_isl  I would do it as below

create one inline table

Load * Inline [
Dim
1
2
3 ];

 

Create a Bar chart with below dimension. Assuming you have created Year and Month fields in your application. where Month is created in the calendar script as Date(monthstart(SalesDate),'MMMM').

 

 

=pick(Dim,'Target '& $(=max(Year)-2),'Target '& $(=max(Year)-1),date(Month,'MMMM'))

 

 

Below expression

 

 

=pick(Dim,
sum({<Year={"$(=max(Year)-2)"}>}Target),
sum({<Year={"$(=max(Year)-1)"}>}Target),
sum({<Year={"$(=max(Year))"}>}Actual))

 

 

 

Go to Chart properties -> Add-Ons-> Reference lines -> Reference lines expression -> add below expression

 

 

=sum({<Year={"$(=max(Year))"}>}Target)

 

 

 

Screenshot 2024-09-23 at 10.34.50.png

 

Note:  Change your expression according to your data and requirements

jdy_isl
Contributor
Contributor
Author

 oh, cool! Thank you for your suggestions @Kushal_Chawda!

I will try this one out. Cheers!

Kushal_Chawda

@jdy_isl  Just made dimension also dynamic in my last reply. check out