cancel
Showing results for
Did you mean:  Having two types of sales grouped into three. Type1 Sales, Type 2 Sales, and Mixed Sales

I have a sales listing.

Sales are grouped according to document number.

Each document number can have multiple sales lines.

VL Sales: All sales lines are of the VL type.

VR Sales: All sales lines are of the VR type.

Mixed Sales: There are sales lines that are VL and VR.

The column "My Check" I have created manually and it is my goal, that by means of code that data is completed for each and every one of the sales lines.

"Check Solution 1" is the column created with the first solution you provided.

"Check solution 2" is a measure created with the second solution you provided.

My goal is to get a chart like the one below, in which I can get a summary of sales according to the "type line Sale" made. And that the unclassified 3284.28 come out correctly classified and add up to 3550.99 between VL, VR and VMixta. 1 ACCEPTED SOLUTION  Super User

Try this calculated column in Tabla:

Grouping =
VAR vCountVL =
CALCULATE (
COUNT ( Tabla[NumOp] ),
ALLEXCEPT ( Tabla, Tabla[NumOp] ),
Tabla[Type Line Sale] = "VL"
)
VAR vCountVR =
CALCULATE (
COUNT ( Tabla[NumOp] ),
ALLEXCEPT ( Tabla, Tabla[NumOp] ),
Tabla[Type Line Sale] = "VR"
)
VAR vCountAll =
CALCULATE ( COUNT ( Tabla[NumOp] ), ALLEXCEPT ( Tabla, Tabla[NumOp] ) )
VAR vResult =
SWITCH (
TRUE (),
vCountVL = vCountAll, "VL",
vCountVR = vCountAll, "VR",
"VMIXTA"
)
RETURN
vResult 2 REPLIES 2  That is the solution. Thank you very much for your help. Greetings.  Super User

Try this calculated column in Tabla:

Grouping =
VAR vCountVL =
CALCULATE (
COUNT ( Tabla[NumOp] ),
ALLEXCEPT ( Tabla, Tabla[NumOp] ),
Tabla[Type Line Sale] = "VL"
)
VAR vCountVR =
CALCULATE (
COUNT ( Tabla[NumOp] ),
ALLEXCEPT ( Tabla, Tabla[NumOp] ),
Tabla[Type Line Sale] = "VR"
)
VAR vCountAll =
CALCULATE ( COUNT ( Tabla[NumOp] ), ALLEXCEPT ( Tabla, Tabla[NumOp] ) )
VAR vResult =
SWITCH (
TRUE (),
vCountVL = vCountAll, "VL",
vCountVR = vCountAll, "VR",
"VMIXTA"
)
RETURN
vResult   