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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
emmanuelfabalos
Regular Visitor

Count Sales Orders by a List of Customers in another table

Hello, hope you're all well. Please I need help on selecting the correct DAX functions to use.

 

I have a Customer table identifying them with an ID and containing all their contact information, an Orders table that links the orders to that ID and third table that contains the IDs that are part of a special program for customers. The three of them have a relationship with ID field.

 

I would like to separate count the orders that were purchased by those IDs contained in the third table (members of that special program) and also the other ones to evaluate the effectiveness of the program.

 

What's the best way to do it?

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @emmanuelfabalos 

Showing your tables or sharing a mock pbix would make providing an answer simpler.

You can create measures and place them in a visual cards:

NumOrders_Cust_InProgram =
CALCULATE (
    DISTINCTCOUNT ( OrdersT[ID] ),
    FILTER ( ALL ( OrdersT[ID] ), OrdersT[ID] IN DISTINCT ( Table3[ID] ) )
)
NumOrders_Cust_Not_InProgram =
CALCULATE (
    DISTINCTCOUNT ( OrdersT[ID] ),
    FILTER ( ALL ( OrdersT[ID] ), NOT OrdersT[ID] IN DISTINCT ( Table3[ID] ) )
)

Please mark the question solved when done and consider giving kudos if posts are helpful.

 Cheers 

SU18_powerbi_badge

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @emmanuelfabalos 

Showing your tables or sharing a mock pbix would make providing an answer simpler.

You can create measures and place them in a visual cards:

NumOrders_Cust_InProgram =
CALCULATE (
    DISTINCTCOUNT ( OrdersT[ID] ),
    FILTER ( ALL ( OrdersT[ID] ), OrdersT[ID] IN DISTINCT ( Table3[ID] ) )
)
NumOrders_Cust_Not_InProgram =
CALCULATE (
    DISTINCTCOUNT ( OrdersT[ID] ),
    FILTER ( ALL ( OrdersT[ID] ), NOT OrdersT[ID] IN DISTINCT ( Table3[ID] ) )
)

Please mark the question solved when done and consider giving kudos if posts are helpful.

 Cheers 

SU18_powerbi_badge

It worked perfectly, was just what I needed.

 

Thanks a lot.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors