Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

qlikviewforum
Contributor II

How to achieve the given bar chart

How to achieve the below output in barchart? We should always show latest 7 Quarter.(i,e) 2019-Q2 is added it should the bar till 2017-Q4.Also please note that there is no date field provided in the data set.

My idea was to generate the date based in the year start which is 2016 and then achieve the chart using the set analysis.

Please share your thoughts and best approach to achieve this.

Quarter Chart.jpg

 

Labels (1)
1 Solution

Accepted Solutions
vitaliichupryna
Contributor II

Re: How to achieve the given bar chart

Hi,

You can create index based on Year & Quarter fields, so in your case: Year 2016 and Quarter Q1 will have index 1 and Year 2019 and Q1 will be 13, for this you can use autonumber function AutoNumber([Quarter]&Year, 'Quarter') AS QuarterIndex
After this you can use following set expression:
SUM({<QuarterIndex = {">=$(=Max(QuarterIndex )-6)"} >} Sales)

Thanks,
Vitalii
2 Replies
vitaliichupryna
Contributor II

Re: How to achieve the given bar chart

Hi,

You can create index based on Year & Quarter fields, so in your case: Year 2016 and Quarter Q1 will have index 1 and Year 2019 and Q1 will be 13, for this you can use autonumber function AutoNumber([Quarter]&Year, 'Quarter') AS QuarterIndex
After this you can use following set expression:
SUM({<QuarterIndex = {">=$(=Max(QuarterIndex )-6)"} >} Sales)

Thanks,
Vitalii
qlikviewforum
Contributor II

Re: How to achieve the given bar chart

With the use of =Year&''&Quarter in the dimension with above one as expression it does work.