Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to use if condition into variable calculation. I need to identify if day of the week is Monday to go back 2 days until Saturday.
the expresions works well, I valideted both, however the if condition is not working well.
if( num(weekday(Date)) = 1,
Count(
{$
<Date={"$(=Date(max(Date),'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={1}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
+
<Date={"$(=Date(max(Date)-2,'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
}
distinct Numero_OrdenVenta),
Count(
{$
<Date={"$(=Date(max(Date),'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={1}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
+
<Date={"$(=Date(max(Date)-1,'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
}
distinct Numero_OrdenVenta))
Somebody can help me?
thank you!
where are you using that variable ?
Into chart: table
I guess it should work. You are just storing the expression as is into variable.
If you expression is working without adding it to variable then break it down and use 2 variable instead.
Maybe use
Variable1:
Count(
{$
<Date={"$(=Date(max(Date),'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={1}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
+
<Date={"$(=Date(max(Date)-2,'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
}
distinct Numero_OrdenVenta)
Variable2:
Count(
{$
<Date={"$(=Date(max(Date),'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={1}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
+
<Date={"$(=Date(max(Date)-1,'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0}, TipoDeEntrega -= {'SOLO FACTURA'},Year={$(vAñoActual)},Month=,Week=>
}
distinct Numero_OrdenVenta))
This into Variable and if( num(weekday(Date)) = 1, separate?
Ex:
if( num(weekday(Date)) = 1, $(Variable1),$(Variable2))
Not sure if it will work... but I usually break down large expressions into different sets of variable.
to go further you should provide a sample document with your issue.
I created the both variables, I can see the both variables return the result well. However the if sentence does not works well, looks like the condition is not valide becase does not return the first variable, just the second one.
it could be caused by your table dimensions.
which dimensions and measures are you using in table object?
Before insert into table I am using KPI to see the number, I think my problem is the if condition, I should SET in Main something.... like SET FirstWeekDay=6;
what you get with the below expression ?
=num(weekday(today()))
Well I need to use Date, because the measurement is any date. Any way I set "SETFirstWeekDay=0" ; and now IF statement Works.
Thank you for your help, I really appreciated