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
RustyNails
Helper III
Helper III

Count number of items in category and verify if all of them have a specific status

Hello, I would like to verify the number of Orders in a table for each Customer, and if all the Orders were shipped. If All the orders were shipped, then I want to say "All Orders Complete" is "Yes" for that Customer.

 

Example: Lets call this Orders Table -

Customer_IDOrder IDOrder ShippedAll Orders Complete
A00011143095 No
A00011080930YesNo
A00011139737YesNo
B00022584618 No
B00022618961YesNo
C00033282832YesYes
C00033665548YesYes
C00033758698YesYes

 

Only C0003 is "Yes" for All Orders Complete because all three Orders for him were shipped. Then I want to present this data in this format in a visual (which I'll do)

Customer_IDAll Orders Complete
A0001No
B0002No
C0003Yes

 

The problem is, the Orders Table has specific SKU level information. I want to ignore the SKU level granularity and present the data at the Order level (and eventually at Customer level). So the granularity is Customer -> Order -> SKU.

 

This is what I have so far

All Orders Complete =
var temp = SUMMARIZE(OrdersTable, OrdersTable[Customer_ID], OrdersTable[Order ID], "Order Count", DISTINCTCOUNT(OrdersTable[OrderID]))"
return IF ( COUNTX(temp,[Order Count]) = DISTINCTCOUNT(OrdersTable[Order ID]), "Yes","No")

 

Any help is appreciated

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @RustyNails ,

You can try to use following measure formula if it suitable for your requirement:

Measure =
IF (
    CALCULATE (
        DISTINCTCOUNT ( T1[Order ID] )
            - CALCULATE ( DISTINCTCOUNT ( T1[Order ID] ), T1[Order Shipped] = "Yes" ),
        VALUES ( T1[Order ID] )
    ) = 0,
    "Yes",
    "No"
)

If above not help, please share some sample data for test.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @RustyNails ,

You can try to use following measure formula if it suitable for your requirement:

Measure =
IF (
    CALCULATE (
        DISTINCTCOUNT ( T1[Order ID] )
            - CALCULATE ( DISTINCTCOUNT ( T1[Order ID] ), T1[Order Shipped] = "Yes" ),
        VALUES ( T1[Order ID] )
    ) = 0,
    "Yes",
    "No"
)

If above not help, please share some sample data for test.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.