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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MansRydell
Helper II
Helper II

I get to many rows

Hi All

 

I need to show the delivery completion status for orders.

Each Order has 1 or more orderlines with same order number, like this

Order no'order'[supplier_skey]orderd quantityrecived quantity
1122
1122
2222
2221
3320
3320

What I´m after is to build a messure called "delivery completion status" that I can add to a table like this with resulte as below.

Order no'supplier'[name]Sum(orderd quantity)Sum(recived quantity)Delivery Completion Status 
1ada44YES
2bob43PARTIALLY
3cid40NO

YES is true if (orderd quantity=recived quantity)

NO  is true if (orderd quantity=0)

PARTIALLY  is true if (orderd quantity>0 AND orderd quantity<recived quantity)

EMPTY is else

 

I´ve built this Messure:

Aditro order completed =
VAR Orderd =
    SUM ( 'Order'[orderd quantity] )
VAR Recived =
    SUM ( 'Order'[recived quantity] )
RETURN
    CALCULATE (
        SWITCH (
            TRUE (),
            Orderd = Recived , "YES",
            Orderd = 0, "NO",
            Orderd < Recived
                && Orderd > 0, "PARTIALLY",
            "EMPTY"
        ),
        'Order'[company] = 1,
        'Order'[Route] = "west"
    )

(I also need to filter in company and route but I don´t think that is an issue here)

My result is this:

Order no'Supplier'[name]Sum(orderd quantity)Sum(recived quantity)Delivery Completion Status 
1ada22YES
1ada22YES
2bob22YES
2bob21PARTIALLY
3cid20NO
3cid20NO

 

1 ACCEPTED SOLUTION
MansRydell
Helper II
Helper II

Ok there is a stupid guy infront of this computer that forgot to check filtering directons in the model. Solved it with a lookup.

 

Sorry for bothering you guys with this nonsens

 

Måns

View solution in original post

4 REPLIES 4
MansRydell
Helper II
Helper II

Ok there is a stupid guy infront of this computer that forgot to check filtering directons in the model. Solved it with a lookup.

 

Sorry for bothering you guys with this nonsens

 

Måns

Hi @MansRydell ,

 

It turned out to be for this reason. If your question is resolved, you can mark the correct response as a standard answer to help the other members find it more quickly.😁


Best Regards,
Henry

 

Anonymous
Not applicable

hi @MansRydell ,

 

Try creating following 3 measures as mentioned below.

 

Total_Quan = CALCULATE(sum('Table'[orderd quantity]),ALL('Supplier'[name]))
 
Total_Rec_Quan = CALCULATE(sum('Table'[recived quantity]),ALL('Supplier'[name]))
 
_Status_Con =   CALCULATE ( SWITCH (
            TRUE (),
            Total_Quan = Total_Rec_Quan , "YES",
            Total_Quan = 0, "NO",
            Total_Quan < Total_Rec_Quan
                && Total_Quan > 0, "PARTIALLY",
            "EMPTY"
        )
 
 
Thanks!
v-henryk-mstf
Community Support
Community Support

Hi @MansRydell ,

 

At this stage, it is impossible to conduct further tests based on the information you provided. Whether it is possible to provide relevant data models (delete sensitive information) and clear needs, I will answer for you as soon as possible.

 

Best Regards,
Henry

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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