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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
himabinduch
Creator
Creator

Aggr Function

Hi All,

i have 3 fields as Item, Item_creation date and item_shipped date one item can have multiple Shipped date but only one creation date.

now i want the data as based on the quarter i need count of created items and shipped items the data is as below

   

ItemItem_creationitem_shipped
CD891/8/2016 15:4611/22/2016 20:16
CD891/8/2016 15:4612/6/2016 20:17
CD891/8/2016 15:4612/13/2016 20:17
CD891/8/2016 15:4612/20/2016 20:16
CD891/8/2016 15:463/21/2017 21:15
CD891/8/2016 15:463/21/2017 21:15
CD891/8/2016 15:466/20/2017 21:16
CD903/8/2017 10:547/11/2017 23:46
CD911/8/2016 15:468/3/2016 21:16
CD911/8/2016 15:468/23/2016 21:16
CD911/8/2016 15:469/7/2016 21:15
CD911/8/2016 15:469/12/2016 21:16
CD911/8/2016 15:469/21/2016 21:16
CD911/8/2016 15:4610/12/2016 21:16
CD911/8/2016 15:4611/1/2016 0:01
CD911/8/2016 15:4611/1/2016 0:01
CD911/8/2016 15:4611/29/2016 20:17
CD911/8/2016 15:4612/5/2016 2:47
CD911/8/2016 15:4612/18/2016 20:17
CD911/8/2016 15:4612/20/2016 20:16
CD911/8/2016 15:4612/28/2016 20:17
CD911/8/2016 15:463/1/2017 20:15
CD911/8/2016 15:464/7/2017 1:04
CD911/8/2016 15:467/5/2017 21:16
CD911/8/2016 15:467/14/2017 3:27
23 Replies
himabinduch
Creator
Creator
Author

Hi Anil,

i dint get you exactly could you please brief me  

effinty2112
Master
Master

Hi Hima,

Maybe:

RawData:

LOAD * INLINE [

    Item, Item_creation, item_shipped

    CD89, 1/8/2016 15:46, 11/22/2016 20:16

    CD89, 1/8/2016 15:46, 12/6/2016 20:17

    CD89, 1/8/2016 15:46, 12/13/2016 20:17

    CD89, 1/8/2016 15:46, 12/20/2016 20:16

    CD89, 1/8/2016 15:46, 3/21/2017 21:15

    CD89, 1/8/2016 15:46, 3/21/2017 21:15

    CD89, 1/8/2016 15:46, 6/20/2017 21:16

    CD90, 3/8/2017 10:54, 7/11/2017 23:46

    CD91, 1/8/2016 15:46, 8/3/2016 21:16

    CD91, 1/8/2016 15:46, 8/23/2016 21:16

    CD91, 1/8/2016 15:46, 9/7/2016 21:15

    CD91, 1/8/2016 15:46, 9/12/2016 21:16

    CD91, 1/8/2016 15:46, 9/21/2016 21:16

    CD91, 1/8/2016 15:46, 10/12/2016 21:16

    CD91, 1/8/2016 15:46, 11/1/2016 0:01

    CD91, 1/8/2016 15:46, 11/1/2016 0:01

    CD91, 1/8/2016 15:46, 11/29/2016 20:17

    CD91, 1/8/2016 15:46, 12/5/2016 2:47

    CD91, 1/8/2016 15:46, 12/18/2016 20:17

    CD91, 1/8/2016 15:46, 12/20/2016 20:16

    CD91, 1/8/2016 15:46, 12/28/2016 20:17

    CD91, 1/8/2016 15:46, 3/1/2017 20:15

    CD91, 1/8/2016 15:46, 4/7/2017 1:04

    CD91, 1/8/2016 15:46, 7/5/2017 21:16

    CD91, 1/8/2016 15:46, 7/14/2017 3:27

];

Data:

LOAD

Item,

Item_creation as DateTime,

'Creation' as Event

Resident RawData;

LOAD

Item,

item_shipped as DateTime,

'Shipped' as Event

Resident RawData;

Drop Table RawData;

Then this straight table with calculated dimension QuarterName(DateTime):

=QuarterName(DateTime) Count({$<Event = {'Creation'}>}Item) Count({$<Event = {'Shipped'}>}Item)
25 25
Jan-Mar 2016240
Jul-Sep 201605
Oct-Dec 2016012
Jan-Mar 201713
Apr-Jun 201702
Jul-Sep 201703

EDIT:

=QuarterName(DateTime) Count(DISTINCT{$<Event = {'Creation'}>}Item) Count({$<Event = {'Shipped'}>}Item)
3 25
Jan-Mar 201620
Jul-Sep 201605
Oct-Dec 2016012
Jan-Mar 201713
Apr-Jun 201702
Jul-Sep 201703

Regards

Andrew

Anil_Babu_Samineni

Flags already setup by Andrew, you can look over his reply

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MarcoWedel

Hi,

maybe another solution might be:

QlikCommunity_Thread_277641_Pic1.JPG

QlikCommunity_Thread_277641_Pic2.JPG

QlikCommunity_Thread_277641_Pic3.JPG

tabItems:

LOAD Item,

     Timestamp#(Item_creation,'M/D/YYYY h:mm') as Item_creation,

     Timestamp#(item_shipped,'M/D/YYYY h:mm') as Item_shipped

FROM [https://community.qlik.com/thread/277641] (html, codepage is 1252, embedded labels, table is @1);

tabDateLink:

CrossTable (DateType, Date)

LOAD Item,

     DayName(Item_creation) as Creation,

     DayName(Item_shipped) as Shipped

Resident tabItems;

tabCalendar: 

LOAD *, 

     Day(Date) as Day, 

     WeekDay(Date) as WeekDay, 

     Week(Date) as Week, 

     WeekName(Date) as WeekName, 

     Month(Date) as Month, 

     MonthName(Date) as MonthName, 

     Dual('Q'&Ceil(Month(Date)/3),Ceil(Month(Date)/3)) as Quarter, 

     QuarterName(Date) as QuarterName, 

     Year(Date) as Year, 

     WeekYear(Date) as WeekYear;   

LOAD Date(MinDate+IterNo()-1) as Date 

While MinDate+IterNo()-1 <= MaxDate; 

LOAD Min(Date) as MinDate, 

     Max(Date) as MaxDate 

Resident tabDateLink;

see also:

Canonical Date

hope this helps

regards

Marco

himabinduch
Creator
Creator
Author

Hi Andrew,

thanks for your help its is working fine but i have one problem now i have to create % of shipped items in different quarters so i used below expression

=(Count(DISTINCT{$<Event={'Shipped'}>}ITEM)/Count(DISTINCT{$<Event={'Creation'}>}ITEM))*100 & ' %'

But now I am facing some issue with this percentage some items are created in 2016 Q1 and shipped in 2017Q2 so now my chart should show the values for that particular items as below

For example

Itemcount_item_creationcount_shipped_itemCUMMULATIVE%quarter
cd891002016Q1
CD891002016Q2
cd891002016Q3
cd891002016Q4
cd891002017Q1
cd891112017Q2
effinty2112
Master
Master

HI,

Maybe this pivot table is what you're looking for:

Item CD89CD90CD91
=QuarterName(DateTime) ShippedShipped %ShippedShipped %ShippedShipped %
Jan-Mar 2017228.57% 15.88%
Oct-Dec 2016457.14% 847.06%
Apr-Jun 2017114.29% 15.88%
Jul-Sep 2017 1100.00%211.76%
Jul-Sep 2016 529.41%

Shipped: Count({$<Event = {'Shipped'}>}Item)

Shipped % : Count({$<Event = {'Shipped'}>}Item)/Count({$<Event = {'Shipped'}>}TOTAL <Item> Item)

Regards

Andrew

himabinduch
Creator
Creator
Author

Hi Andrew,

i need pivort like below

Capture.PNG

himabinduch
Creator
Creator
Author

the exact one is as below here fg mcns setup is nothing but  created item count and Cumulative transactions is nothing but shipped item count Capture1.PNG

himabinduch
Creator
Creator
Author

Hi Marco,

thank for your help but i need the data in pivot table and i need the count of create item and shipped item in the same quarter for example if i have 10 items created in 2017Q1 created items are 10 and it got shipped in 2018 Q1 it not suppose to show in any of the quarter even in 2018Q1

thanks,

hima

vikasdesai
Partner - Contributor III
Partner - Contributor III

Hello

Please use Following Expression

Count({<Quarter={$(=max(Quarter))}>}[FieldName])

Regards

Vikas