cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

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.

https://1drv.ms/u/s!AmRMGhswPKfD929RMuToyEAHE6x-?e=5retIu

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.

Buscavidas_0-1626732543944.png

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Buscavidas,

 

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

 

DataInsights_1-1626826174435.png

 

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

That is the solution. Thank you very much for your help. Greetings.

DataInsights
Super User
Super User

@Buscavidas,

 

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

 

DataInsights_1-1626826174435.png

 

View solution in original post

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors