Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Announcement: Certain actions are currently causing a Page Not Found error. This is a known issue and we are working with the platform vendor to investigate and resolve it.
Highlighted
Manuel06
New Contributor

Last 3 months separate on bar chart per product

Hello all,

I am trying to create a bar chart displaying the 3 latest months in one chart per product (or in this case the number of flights per aircraft). I am very new to Qlik Sense so any help or advice would be really appreciated!

_20190404_110201.JPG

Dates are loaded as follows:

Link:
LOAD
datetype,
date,
Day(date) as Ops_day,
Month(date) as Ops_month,
Year(date) as Ops_year

 

Thanks in advance,

Manuel

3 Replies
Channa
Valued Contributor III

Re: Last 3 months separate on bar chart per product

=SUM({$<Date= {">=$(=AddMonths( MonthStart (Today()),-3))<=$(=MonthEnd(Today())"}>}Sales)

Channa
Shubham_Deshmukh
Valued Contributor

Re: Last 3 months separate on bar chart per product

My Mistake, let me edit my answer
Shubham_Deshmukh
Valued Contributor

Re: Last 3 months separate on bar chart per product

Hi @Manuel06 ,

Take Product as your Dimension and 3 expressions for 3 months,

Expression 1 : =sum(if(yourDateField>=MonthStart(AddMonths(Today(),-2)) and yourDateField<=MonthEnd(AddMonths(Today(),-2)), yourField))
Expression 2 : =sum(if(yourDateField>=MonthStart(AddMonths(Today(),-1))  and yourDateField<=MonthEnd(AddMonths(Today(),-1)), yourField))
Expression 3 : =sum(if(yourDateField>=MonthStart(Today()) and yourDateField>=MonthEnd(Today()), yourField))

Here I am taking 3 months Feb, Mar, Apr. Adjust AddMonths() parameter according to your requirement.

-Shubham