Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis question (grouping by date)

Hi Community,

I need to generate a very simple report but I can't solve a issue. 

I have to show in a table (where the closing date is the dimension, and two expressions as columns: amount of closed tasks and amount of open tasks in this period.


Example:

Input Data:

Task No.Request DateFinish  Date
TS00001dic-12ene-13
TS00002ene-13ene-13
TS00003ene-13feb-13
TS00004ene-13ene-13
TS00005ene-13feb-13
TS00006ene-13mar-13
TS00007feb-13feb-13
TS00008feb-13mar-13
TS00009feb-13feb-13
TS00010feb-13mar-13
TS00011feb-13feb-13
TS00012feb-13mar-13
TS00013mar-13mar-13
TS00014mar-13mar-13
TS00015mar-13abr-13
TS00016abr-13abr-13

Expected result: (Request Date is the dimension)

Month# of Task Opened# of Task Closed
ene-1353
feb-1365
mar-1336
abr-1312

But when I take the closing date as dimension, I left out tasks to count as open for that period (because they are affected by selection), I try a lot of workarounds using set analysis but I failed to reach the solution

thanks in advance,

regards,

Leandro

PD: (ene = january, abr = april)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think you can do it like this:

Convert your input cross table to a straight table using CROSSTABLE LOAD prefix:

CROSSTABLE (Type, Date, 1) LOAD

     [Task No.],

     date#([Request Date],'MMM-YY') as [Request],

     date#([Finish Date],'MMM-YY') as [Finish]

FROM

[http://community.qlik.com/thread/81292?tstart=0]

(html, codepage is 1252, embedded labels, table is @1);

[date#() function is only used to parse your request/finish dates correctly in as QV dates, thus allowing a proper sorting in the chart]

Then create a chart with dimenstion Date and two expressions:

=count({<Type = {'Request'} >} [Task No.])

=count({<Type = {'Finish'} >} [Task No.])

See also attached.

View solution in original post

2 Replies
swuehl
MVP
MVP

I think you can do it like this:

Convert your input cross table to a straight table using CROSSTABLE LOAD prefix:

CROSSTABLE (Type, Date, 1) LOAD

     [Task No.],

     date#([Request Date],'MMM-YY') as [Request],

     date#([Finish Date],'MMM-YY') as [Finish]

FROM

[http://community.qlik.com/thread/81292?tstart=0]

(html, codepage is 1252, embedded labels, table is @1);

[date#() function is only used to parse your request/finish dates correctly in as QV dates, thus allowing a proper sorting in the chart]

Then create a chart with dimenstion Date and two expressions:

=count({<Type = {'Request'} >} [Task No.])

=count({<Type = {'Finish'} >} [Task No.])

See also attached.

Not applicable
Author

Hi Swuehl

it works fine!

I had not evaluated using crosstabs, and clearly is the simplest option for what I needed to do.

thanks a lot,