Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
manojkulkarni
Partner - Specialist II
Partner - Specialist II

Help:To build report

Hi Friends,

I am looking for solution/suggestion in building weekly report using below sample data.

Requirement:

We have Activity details captured on daily basis. Activity can be started & completed on same day or it might carry forwarded to next day. I need to prepare a weekly report on this data to show how many activities received and completed in a week. I am not able to get the report for the cases which are started in week1 and closed in week2. How to achieve this ?

Sample Data

ActivityIDActivityDescStart DateEnd Date
A01Test103-01-201703-01-2017
A02Test203-01-201705-01-2017
A03Test303-01-201710-01-2017
A04Test404-01-201706-01-2017
A05Test504-01-201704-01-2017
A06Test605-01-201705-01-2017
A07Test706-01-201710-01-2017
A08Test803-01-201709-01-2017
A09Test909-01-201709-01-2017
A10Test1010-01-201712-01-2017

Expected Out put

   

StartedClosed
Week1 (02 Jan to 6th Jan 2017)85
Week2 (09 Jan to 13th Jan 2017)25
2 Replies
varshavig12
Specialist
Specialist

Try this:

a:

Load ActivityID    ,ActivityDesc    ,date#([Start Date],'DD-MM-YYYY') as StartDate    ,date#([End Date],'DD-MM-YYYY') as EndDate,

Right(WeekName(date#([Start Date],'DD-MM-YYYY')),2) as WeekS,

Right(WeekName(date#([End Date],'DD-MM-YYYY')),2) as WeekC

;

LOAD * INLINE [

    ActivityID    ,ActivityDesc    ,Start Date    ,End Date

    A01    ,Test1    ,03-01-2017    ,03-01-2017

    A02    ,Test2    ,03-01-2017    ,05-01-2017

    A03    ,Test3    ,03-01-2017    ,10-01-2017

    A04    ,Test4    ,04-01-2017    ,06-01-2017

    A05    ,Test5    ,04-01-2017    ,04-01-2017

    A06    ,Test6    ,05-01-2017    ,05-01-2017

    A07    ,Test7    ,06-01-2017    ,10-01-2017

    A08    ,Test8    ,03-01-2017    ,09-01-2017

    A09    ,Test9    ,09-01-2017    ,09-01-2017

    A10    ,Test10    ,10-01-2017    ,12-01-2017

];

b:

Mapping Load ActivityID,WeekC

resident a;

Load ActivityID    ,ActivityDesc, 'C' as flag,

applymap('b',ActivityID) as Week

Resident a;

c:

Mapping Load ActivityID,WeekS

resident a;

Load ActivityID    ,ActivityDesc, 'S' as flag,

applymap('c',ActivityID) as Week

Resident a;

d:

load ActivityID,StartDate,EndDate

Resident a;

drop table a;

Expression: count({<flag={'S'}>}ActivityID)   

                    count({<flag={'C'}>}ActivityID)

Anonymous
Not applicable

Hi Manoj,

Please find following:

Change In Script:-

RawData:

LOAD * INLINE [

    ActivityID, ActivityDesc, Start Date, End Date

    A01, Test1, 03-01-2017, 03-01-2017

    A02, Test2, 03-01-2017, 05-01-2017

    A03, Test3, 03-01-2017, 10-01-2017

    A04, Test4, 04-01-2017, 06-01-2017

    A05, Test5, 04-01-2017, 04-01-2017

    A06, Test6, 05-01-2017, 05-01-2017

    A07, Test7, 06-01-2017, 10-01-2017

    A08, Test8, 03-01-2017, 09-01-2017

    A09, Test9, 09-01-2017, 09-01-2017

    A10, Test10, 10-01-2017, 12-01-2017

];

mainData:

load * ,

WeekStart(date#([Start Date],'DD-MM-YYYY')) AS Start_Week,

WeekStart(date#([End Date],'DD-MM-YYYY')) as End_Week,

WeekStart(date#([Start Date],'DD-MM-YYYY')) as Date1

Resident RawData;

DROP table RawData;

UI table:-


Start_WeekEnd_WeekCount(ActivityID)
1/2/20171/2/20175
1/9/20173
Total8
1/9/20171/9/20172
Total2
Total 10

Let me know if above is working for you

Thanks,

Pooja