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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.