Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last 3 months data in expression for a bar chart

Hi all ,

i have 12 months of data , in which i would like to use last 3 months of data while displaying in bar chart.

for suppose i have feb 2014 to jan 2015 data , my last 3 months data should be jan 2015, dec 2014, Nov 2014

my dimensions are 
terc_defect

monthterc

i need an expression to take last 3 months data

Thanks in advance

27 Replies
Not applicable
Author

yes i want to count the category ,yes i do have many files and it is a large data set

when i am using your formula . i am getting all months in the data set

Capture1.PNG

Capture2.PNG

robert_mika
Master III
Master III

This formula was for data set I have posted not for yours

Not applicable
Author

oh ok , but can you tell me what monthstart(max(monterc),-3 function gives ?

and also what would be desired expression for my data , do you need any more input robert?

robert_mika
Master III
Master III

Try

Script:

Directory;

LOAD Date(terc) as monthterc,

     [Defect Category]

FROM....

Expression:

count({<monthterc={'>$(=monthstart(max(monthterc),-2))'}>}[Defect Category])

Not applicable
Author

hey thanx robert it is working , but now what if i have to calculate average on x axis

my expression is average = sum(defect category)/count(defect category)

how do i use set analysis in this context .

robert_mika
Master III
Master III

Can you say what are you trying to achieve?

You have only Text value so first there is no Sum of any kind and then if you need average with Set Analysis we need a condition.

Not applicable
Author

Hi Robert,

days_openEnterprise system
19Singleview
6Portal
49Android App
69Migration Activity
158Migration Activity
69Migration Activity
61Appsuite
132Appsuite
46Migration Activity
56Migration Activity
32Appsuite
48Migration Activity
151Appsuite
73Appsuite
69Migration Activity
55Migration Activity
69Migration Activity
77Migration Activity
55Migration Activity
59Appsuite
55Migration Activity
48Migration Activity
131Migration Activity
185Mail Client
55Migration Activity
69Migration Activity
59Mail Client
74Migration Activity

now my expression is average = sum(daysopen)/count(enterprise system)

dimensions are enteprise system and monthterc

now i have to limit months using set analysis ?

let me know if you need any more output?

Thanks in advance

robert_mika
Master III
Master III

I would rather have the full set of data(all 3 columns) or a Excel spreadsheet...

If you can please attached.

Not applicable
Author

days_openEnterprise systemMontterc
19Singleview11/11/2014 0:00
6Portal11/11/2014 0:00
49Android App11/14/2014 0:00
69Migration Activity11/14/2014 0:00
158Migration Activity11/27/2014 0:00
69Migration Activity11/27/2014 0:00
61Appsuite11/26/2014 0:00
132Appsuite11/27/2014 0:00
46Migration Activity11/11/2014 0:00
56Migration Activity11/20/2014 0:00
32Appsuite11/6/2014 0:00
48Migration Activity11/12/2014 0:00
151Appsuite11/11/2014 0:00
73Appsuite11/27/2014 0:00
69Migration Activity11/27/2014 0:00
55Migration Activity11/14/2014 0:00
69Migration Activity11/26/2014 0:00
77Migration Activity11/3/2014 0:00
55Migration Activity11/13/2014 0:00
59Appsuite11/3/2014 0:00
55Migration Activity11/3/2014 0:00
48Migration Activity11/3/2014 0:00
131Migration Activity11/4/2014 0:00
185Mail Client11/3/2014 0:00
55Migration Activity11/24/2014 0:00
69Migration Activity11/19/2014 0:00
59Mail Client11/19/2014 0:00
74Migration Activity11/3/2014 0:00

hope it helps

robert_mika
Master III
Master III

=avg({<Montterc={'>$(=monthStart(max(Montterc),-2))'} ,[Enterprise system]= >}days_open)

Script:

LOAD days_open,

  [Enterprise system],

  date(Montterc) as Montterc

FROM

[151270.xlsx]

(ooxml, embedded labels, table is tab1);