Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
callsresri
Contributor III
Contributor III

Need help on Working days Calculation!

Hi All,

Good day!

My Claendar QVD contains the following info.

calendar QVD:

LOAD

[Date Key],

[Calendar Name],

[Fiscal Year],

[Fiscal Period],

[Working Day Divisor]

FROM [$(vQvdFile)](qvd);

but i wanted calculate the below SQL logic using the above QVD info. could you please help me out on the same please.

set   @iDate = tableX(0) /*value 0 gives today, -1 yesterday etc*/

;with Tmpwd as (

select

Country,

Period,

SUM(workingday) as TotalWrkDays,

sum(case

when [DATE] < @iDate then workingday

else 0

end) MTD_Days

from tbl_workingdays_country

group by

Country,

Period    

)

, Cal as (

select a.Country, a.[Date], a.[Period], Tmpwd.TotalWrkDays asTotalPeriodWorkingDays, Tmpwd.MTD_Days as MTD_WorkingDays_Period

from

  tbl_workingdays_country a

inner join Tmpwd on

a.country = Tmpwd.country and

a.period = Tmpwd.period

)



many thanks in advance.


Sree

1 Reply
swuehl
MVP
MVP

Your SQL table seems to reference more tables and fields than contained in your QVD, e.g. country based information.

Not sure how you want to use the same logic then.