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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Monthstart and Monthend

Hi All,

Can anyone help me in getting the below calculation,

Count({<Date=Monthstart(Date)>}empid)

As per my requirement i should get the sum(Count of Employees in Monthstart of every Month. and month end of every month)

Regards,

Priyanka

Labels (1)
18 Replies
Not applicable
Author

Hi Joe,

That was realy helpful.But Monthend Count is not showing properly.Month end count shows total emp id count.

Not applicable
Author

Hi Anadh,

That works for monthstart .But Monthend count shows 0 value.Monthend has values.

its_anandrjs
Champion III
Champion III

Hi,

In Monthend expression write

=Count( if(  trim(Date) = Trim( MonEndDate )   , empid ))

Regards

Anand

jyothish8807
Master II
Master II

Hi Priyanka,

for month end try like this:

if(Date>=monthstart(Date) and Date<=monthend(Date),1,0) as monthendflag.

hope it helps

Regards

KC

Best Regards,
KC
Not applicable
Author

That would surely flag every row with a 1 would it not?

Not applicable
Author

Hi Priyanka,

no problem glad it helped. Not sure why that would be the case, if the month start works. Want to show your working so far and will see if I can help

cheers

Joe

its_anandrjs
Champion III
Champion III

Hi Priyanka,

This is your complete script you have the date format issue i thing for this use Trim to remove spaces from field and get the script as

tmp:

LOAD

       Date(Date,'M/D/YYYY') AS Date,

       MonthStart( Trim(Date)) as MonStartDate,

       MonthEnd(  trim( Date)) as MonEndDate,

       empid,

       Type

FROM

mockup.xlsx

(ooxml, embedded labels, table is Sheet1);

NoConcatenate

N:

LOAD

      Date(Trim(Date)) as Date,

      Date( Trim( MonStartDate )) as MonStartDate,

      Date(Trim( MonEndDate )) as MonEndDate,

      empid,

      Type

Resident tmp;

DROP Table tmp;

And then write expressions:-

Monthstart

=Count( if( Date = MonStartDate  , empid ))

MonthEnd

=Count( if(  (Date) = Trim(MonEndDate)  , empid ))

op2.png

Regards

Anand

jyothish8807
Master II
Master II

Right, my bad Joe.

Best Regards,
KC
Not applicable
Author

no worries, just checking it wasn't my brain being funny this early in the morning