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

Diff two dates

Hello Guys,

I need your help

I have to count the difference between two dates without counting the sundays

Any idea please ?

Thanks

5 Replies
sunny_talwar

May be look here:

Networkdays with saturday

master_student
Creator III
Creator III
Author

i see that the solution is to create a function, how to do that please?

Thanks

sunny_talwar

Function is give by Gysbert in that link

Function GetWorkDays(StartDate, EndDate)

    dCount = 0

    For dt = StartDate To EndDate

        If WeekDay(dt) <> 1 Then

            dCount = dCount + 1

        End If

    Next

    GetWorkDays = dCount

End Function

suryaa30
Creator II
Creator II

Use SET on top, something like this

below example is Not your case:

SET MonthDiff = Num(((year($2) * 12) + month($2)) - (((year($1) * 12) + month($1))) + 1);