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

get the selected working days for previous year

hi all,

i had a scenario like

=if(count({<SalesFy={$(=max(SalesFy)-1)}>}billnumber)>0,count({<SalesFy={$(=max(SalesFy)-1)}>billdate))

The above query working fine financial year,month

but when i select some 4 dates in current year i need to get the same month four dates for previous year

this is for current year and previous year sales comparsion purpose and also for to see the working days count for current and previous year..

Thanks in Advance

20 Replies
MK_QSL
MVP
MVP

Can you provide sample data or app?

sunny_talwar

May be try like this:

Count({<Date ={$(=Concat(Chr(39) & Date(AddYears(Today(), -1), 'DateFieldFormatHere) & Chr(39), ', '))}>}billdate)

Not applicable
Author

Can you explain it this piece of code

=Concat(Chr(39) & Date(AddYears(Today(), -1), 'DateFieldFormatHere) & Chr(39), ', ')

sunny_talwar

Sorry I meant to change Today() to Max(Date)

=Concat(Chr(39) & Date(AddYears(Max(Date), -1), 'DateFieldFormatHere) & Chr(39), ', ')

Not applicable
Author

Chr(39) means can you tell the above function briefly

sunny_talwar

Chr(39) is another way of writing a single Quote (').

I am concatenating the list of dates (comma separated) you selected this year and finding the corresponding dates for them in the last year

Not applicable
Author

i Tried it see it's not showing anything to me

=if(Count({<DateNum={$(=Concat(Chr(39) & Date(AddYears(Max(DateNum), -1), 'MM/DD/YYYY) & Chr(39), ', '))},ITEM={'GOLD'}>}[MASTER REFERENCE CATEGORY CODE])>0,count(distinct {<DateNum={$(=Concat(Chr(39) & Date(AddYears(Max(DateNum), -1), 'MM/DD/YYYY) & Chr(39), ', '))},ITEM={'GOLD'}>}BILLDATE))

sunny_talwar

DateNum is in number format? If it is, then try this:

=If(Count({<DateNum={$(=Concat(Num(AddYears(Max(DateNum), -1)), ', '))},ITEM={'GOLD'}>}[MASTER REFERENCE CATEGORY CODE]) > 0, Count(Distinct {<DateNum={$(=Concat(Num(AddYears(Max(DateNum), -1)), ', '))},ITEM={'GOLD'}>} BILLDATE))

Not applicable
Author

DateNum is floor(DATEFIELD)