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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
5 Replies
sunny_talwar
MVP
MVP

May be look here:

Networkdays with saturday

suryaa30
Creator II
Creator II

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
MVP
MVP

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);