Discussion Board for collaboration related to QlikView App Development.
I made a macro to calculate the delay working days between two dates and I'd like to use it inside a chart expression...something like that:
Sum(If(ArrivalData>=DueDate,GetWorkDays (ArrivalDate, DueDate),0))/Count(NumberOfDocuments)
But the expression give me a syntax error, maybe due to the use of the macro into the expression...is that true? Is there a workaround for the problem?
You can define a variable in which you repeat the logic of your macro, then use variable in expression
I did not understand the purpose to create a macro in such situation. Normally, either we create variable, or a temporary column .
If you must do something like this in chart, then you can create expressions in the chart,
Secondexpression: Sum(If(column(1)>0, GetWorkDays (ArrivalDate, DueDate),0))/Count(NumberOfDocuments)
Something like this should help
Well, the macro is this:
Function GetWorkDays(StartDate, EndDate)
dCount = 0
For dt = StartDate To EndDate
If WeekDay(dt) <> 1 Then
dCount = dCount + 1
GetWorkDays = dCount
Should someone explain to me how can I transform it in a varialble?
Probably you need networkingdate() function instead of the variable
The NetWorkDays() Function considers the work days from Mon to Fri, contrariwise I've to consider Sat as a workable day.
This is the reason I've made the macro.