Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
marygrace
Contributor III
Contributor III

SUM a Value Distinct Orders Today + Yesterday

Hello,

I want to SUM the distict Orders Packeges Today and Yesterday, It already works for today not for yesterday.

Somebody can let me know what is wrong

//SUM Distinct Packeges Today------ is good

SUM(aggr(Sum(distinct{<Date={"$(=Date(max(Date),'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0}, 

       TipoDeEntrega -= {'SOLO FACTURA','NO INVENTARIABLE'},Año={$(vAñoActual)},Mes=,Semana=>}Cant_Cajas),Numero_OrdenVenta))

       

+

//SUM Distinct Packeges Yesterday----- is wrong

SUM(aggr(Sum(distinct{<Date={"$(=Date(max(Date)-1,'DD/MM/YYYY'))"}, _Id_Flag={0},Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0}, 

       TipoDeEntrega -= {'SOLO FACTURA','NO INVENTARIABLE'},Año={$(vAñoActual)},Mes=,Semana=>}Cant_Cajas),Numero_OrdenVenta))

       

Thank you!

47 Replies
swuehl
MVP
MVP

Try adding your set expression also to the outer aggregation function (first SUM)

Set Analysis in the Aggr function

Anil_Babu_Samineni

Because, We need to degrade with the outer aggregation as well like filters as below

Sum({<[Fecha Liberado CyC]={'$(=Date(max([Fecha Liberado CyC])-1,'DD/MM/YYYY'))'},

Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0},

TipoDeEntrega -= {'SOLO FACTURA','NO INVENTARIABLE'}>}

Aggr(Sum(distinct{<[Fecha Liberado CyC]={'$(=Date(max([Fecha Liberado CyC])-1,'DD/MM/YYYY'))'},

Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, Liberado={0},

TipoDeEntrega -= {'SOLO FACTURA','NO INVENTARIABLE'}>}Cant_Cajas), Numero_Entrega))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
OmarBenSalem

I've told u this how I proceeded when I got such a problem.. adding the set expression to the outer aggregation function:

Capture.PNG

Anil_Babu_Samineni

I though the same, But fortunately this won't help for him

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
marygrace
Contributor III
Contributor III
Author

It works,

I appreciate your help

OmarBenSalem

This finalyy worked !

marygrace
Contributor III
Contributor III
Author

Yes, it works

Thank you Omar I did not got it very welll your previous post.

Anil_Babu_Samineni

Great, It worked for you. But Using outer aggregation of analysis needed very rare case where we are doing with same expression.

So, You can mark helpful also for other answer response which feels better ...

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful