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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
data_RN
Creator
Creator

Graphing Bar Chart based on date ranges

Hello All,

Ok, as usual, I have spent way to much time trying to figure out something that is probably ridiculously easy.  I have searched through QS and QV posts and can't seem to find the right syntax.

I need to create a graph showing a stacked bar chart based on if date is less than 12 months from today, more than or entry is blank.

I think it needs to be something like this:

Count({<[Date]>={today(-360)} >} [Program])/count([Program])

Thanks as always!

 

1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

Less than 12 months from today:

Count({<[Date]={"<$(=AddMonths(today(),-12))"} >} [Program])/count([Program])

 

Greater than or equal  12 months ago:

Count({<[Date]={">=$(=AddMonths(today(),-12))"} >} [Program])/count([Program])

 

No Date:

Count({<[Date]-={"*"} >} [Program])/count([Program])

 

View solution in original post

4 Replies
jwjackso
Specialist III
Specialist III

You can use  Set Analysis  with date functions.

Less than 12 months from today:

Count({<[Date]={"<$(=AddMonths(today(),-12))"} >} [Program])/count([Program])

data_RN
Creator
Creator
Author

Thank you Jwjackso!

That got me the count (at least a step forward 🙂 )  but now I need it to be a 100% stacked bar chart with all others being grouped into a "no" category. Similar to the attached .png

 

Any suggestions?

jwjackso
Specialist III
Specialist III

Less than 12 months from today:

Count({<[Date]={"<$(=AddMonths(today(),-12))"} >} [Program])/count([Program])

 

Greater than or equal  12 months ago:

Count({<[Date]={">=$(=AddMonths(today(),-12))"} >} [Program])/count([Program])

 

No Date:

Count({<[Date]-={"*"} >} [Program])/count([Program])

 

data_RN
Creator
Creator
Author

Oh...of course!  I was trying to squeeze it into one measure, but that makes total sense.  Thank you!!!

I did modify the last one to use NULLCOUNT:

nullcount ([Date])/count([Program])

I literally spent all morning on this before posting...this was so helpful...cheers! 🙂