Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

cancel
Showing results for 
Search instead for 
Did you mean: 
MatteoBerlaSV
Partner
Partner

Last and Next 6 months in a bar chart

Hi everyone,

I need to display in a bar chart last and next 6 months formatted as : dec 2019 gen 2020 etc etc

I saw other questions but the solutions are not working for me probably because i'm new to qlik.

I'm retrieving some data from a query and I need a dimension (MyOrderDate) as I specified and an Amount (=Sum(MyorderValue)) as  measure. the result i want to achieve is like this.

Thank you in advance!

199827_Capture5.png

Labels (2)
8 Replies
avinashelite

could you share the sample data sets and what your trying to achieve 

MatteoBerlaSV
Partner
Partner
Author

I'm sorry but are private data sets.

I can give you some more information althoug, I'm retrieving from a table the list of  currently open orders which has the amount of each order (in €) and the escape date of each order in every row.

now what I get is like that: 

Order|  TotalAmount|  DateOfOrder

1               100€           2019-12-01

2               300€           2020-01-01

 

what i want to achieve is a graph as i showed in the question that shows me last and next  6 months as dimension and the total in € of all my orders as measure

 

avinashelite

Do you have the data for Next 6 months?  if that is the case try like this in the chart 

1.Create 2 variables like below

 vLastsixMonth  =AddMonths(Today(),-6)

vNextsixMonth   =AddMonths(Today(),6)

 

In the Bar Chart

Dim : DateOfOrder

Expression: sum({<DateOfOrder={">=$(vLastsixMonth )<=$(vNextsixMonth   )"}>}TotalAmount)

MatteoBerlaSV
Partner
Partner
Author

It says dimension not valid, my string is:

=sum({<Eorddataeva={">=$(vLastsixMonth)<=$(vNextsixMonth)"}>}Eordimporto)

Eorddataeva is the DateofOrder

Eordimporto is the AmountOfTheOrder

I declared variables in my editor, is it right? 

avinashelite

You need to create the variable in the front end at sheet level , check this link 

https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Variables/create-variabl...

MatteoBerlaSV
Partner
Partner
Author

I've done what you said but i can't see anything, 

dim: dateOfOrder

measure: string you've written

avinashelite

Dimension name you need to use according  your data set in your case

Eorddateva

MatteoBerlaSV
Partner
Partner
Author

yes, i did it but doen't work, this is what i see

Annotazione 2020-08-04 114042.png