Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bar Chart, overlap time dimension and set analyses

I am trying to create a bar chart with a tricky dimension.

My dimension constists of months (duration), but on the 1st bar I need everything (all months), on the 2nd  bar I need all month >=1 (including 2,3, ... month), on the 3rd bar I need all month >=2 (incl. 3,4,6,12 ...), then >= 3, >= 6 and >=12 months.

The problem is, I cannot use "if (month >=1, then ...) because I wont get the values >2 in the next if.

Diagramm.bmp

Tha stacks on the bar a the sum(Standard), sum(non standard) and sum(other), but how can I create the dimension? I treid the script and dynamic dimension, but nothing worked.

Enclosed you will find the start-application

Thanks in advanced

1 Solution

Accepted Solutions
jjfabian
Partner - Creator III
Partner - Creator III

Ok, I hope this is what you really need. See the attached file.

I used the initial if statement as a temporary dimension to create the actual dimension with an inline table

Hope that can be a start for you!

Regards,

Jakob

View solution in original post

6 Replies
jjfabian
Partner - Creator III
Partner - Creator III

Hi there,

you could try creating an dimension in your script that classifies "duration_months" into your needed dimensions. That would make things a lot easier to display as you could use it as an actual dimension.

Add Something like in your script:

if(duration_months>=0, 'All',

     if(duration_months>=1, '>=1 Months',

          if(duration_months>=3, '>=3 Months',

               if(duration_months>=6, '>=6 Months',

                    if(duration_months>=12, '>=12 Months' ))))) as Dimension_duration_months

Then use your new dimension and set analysis in your chart such as:

sum({$<duration_months={'>=3'}>}Value)

Your values should then be put into the correct dimensions.

Regards,

Jakob

Not applicable
Author

thanks but I dont think this will work. I already tried this to learn, tha the first if-statement concludes all, but the second if never happens, because the first if already has everything.

If >= 0, then everything will be included, so the second if >=1 never happens.

I put in the script into the application.

Not applicable
Author

Best Thanks Jakob, to reverse the statement will also not work.

to reverse the if-statements will result:

month 12 up to X

month 6 up to 11

month 3 up to 5

month 1 up to 2

But I need

month 12 up to x

month 6 up to X      

month 3 up to X

month 1 up to X

jjfabian
Partner - Creator III
Partner - Creator III

Sorry, I just saw that too. I will have another look and try to get back to you with a better idea if I come up with one.

jjfabian
Partner - Creator III
Partner - Creator III

Ok, I hope this is what you really need. See the attached file.

I used the initial if statement as a temporary dimension to create the actual dimension with an inline table

Hope that can be a start for you!

Regards,

Jakob

Not applicable
Author

Thanks a lot, this looks really good.

This is it.!