Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
agg
Contributor II
Contributor II

Calendar issue

Hi!

I have this calendar in my QlikSense App

LET vFM = 10; // first month of the fiscal year
[Fisc]:
DECLARE FIELD DEFINITION Tagged ('$date')
FIELDS
// Dual(Right(YearStart($1,0,vFM),2)&'/'&(Right(YearStart($1,0,vFM),2)+1), YearStart($1,0,vFM)) AS [FiscalYear] Tagged ('$axis', '$year'),
Dual('FY'&(Right(YearStart($1,0,vFM),2)+1), YearStart($1,0,vFM)) AS [FiscalYear] Tagged ('$axis', '$year'),
Dual('T'&Num(Ceil(Num(Month(AddMonths($1,1-vFM)))/3)),Num(Ceil(NUM(Month(AddMonths($1,1-vFM)))/3),00)) AS [FiscalQuarter] Tagged ('$quarter', '$cyclic'),
Dual(Right(YearStart($1,0,vFM),2)&'/'&(Right(YearStart($1,0,vFM),2)+1)&'-T'&Num(Ceil(Num(Month(AddMonths($1,1-vFM)))/3)),QuarterStart($1)) AS [FiscalYearQuarter] Tagged ('$yearquarter', '$qualified'),
Dual('T'&Num(Ceil(Num(Month(AddMonths($1,0,1-vFM)))/3)),QuarterStart($1)) AS [Fiscal_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),
Dual(Month($1), Month($1)) AS [Month] Tagged ('$month', '$cyclic'),
// Dual(Right(YearStart($1,0,vFM),2)&'/'&(Right(YearStart($1,0,vFM),2)+1)&'-'&Month($1), monthstart($1)) AS [FiscalYearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),
Dual('FY'&(Right(YearStart($1,0,vFM),2)+1)&'-'&Month($1), monthstart($1)) AS [FiscalYearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),
Dual(Month($1), monthstart($1)) AS [Fiscal_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),
Dual('S'&Num(Week($1),00), Num(Week($1),00)) AS [Semana] Tagged ('$weeknumber', '$cyclic'),
Date(Floor($1)) AS [FiscalDate] Tagged ('$axis', '$date', '$qualified'),
Date(Floor($1), 'D') AS [Fiscal_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),
If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,
Year(Today())-Year($1) AS [YearsAgo] ,
If (DayNumberOfQuarter($1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,
4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,
Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,
If(Day($1)<=Day(Today()),1,0) AS [InMTD] ,
12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,
Month(Today())-Month($1) AS [MonthRelNo],
If(WeekDay($1)<=WeekDay(Today()),1,0) AS [InWTD] ,
(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,
Week(Today())-Week($1) AS [WeekRelNo]
;
// create derived fields for fiscal year
DERIVE FIELDS FROM FIELDS OrdDt USING [Fisc] ;

Until now I have selected info using just one date with no problem.

However, I need to get some info from a PROJECT table where I have two dates StartDate and EndDate. I need to calculate how many projects have started in a time period (using StartDate) and how many projects have ended in the same period (using EndDate) so I can have the open vs closed ratio.

I've been trying to find a proper solution but I haven't been able to find it.

Any idea or suggestion to deal with this problem?

Thanks in advance.

Best regards,

Àlex

3 Replies
JordyWegman
Partner - Master
Partner - Master

Hi Alex,

What do you mean with the 'same period', the following maybe?

  1. Select month May and you get:
    1. All projects started in May
    2. All projects end in May

If you want this, you can do the following:

Count(Distinct {$<[StartDate] = p( [StartDate]) >}  Project) / Count(Distinct {$<[EndDate] = p( [EndDate]) >} Project)

 Jordy
Climber

Work smarter, not harder
agg
Contributor II
Contributor II
Author

Hi Jordy,

Thanks for your reply.

That was exactly what I needed to do. It worked as a charm.

Best,

Àlex

 

JordyWegman
Partner - Master
Partner - Master

Great! Please Mark the answer as solved the everybody knows that it has been solved!

Jordy 

Climber 

Work smarter, not harder