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
nanat
Frequent Visitor

Adding Filter on Countrows and Relatedtable

Hi,

 

I need some help please. I have 2 tables (All Customers, Product Items). These 2 tables are linked by the unique Customer ID with All Customers as the 1 side and Product Items as the many sides.

I am trying to get a calculated column in All Customers to achieve the unique number of invoiced product orders each customer has placed. Please note that Product Items list the items customers have ordered but do not relate to orders - meaning 3 product items can equal to 1 order.

What I have so far is:

 

Product Order per Customer = 
COUNTROWS(
    RELATEDTABLE('Product Items Internal ID')
)

 

This gives me the number of product items each customer has placed but I need the number to be the unique number of product orders and also a filter which it will filter the Status of Product Items to be "Invoiced". 

 

I have tried a few times but the filter would not work. How can I add in a filter that will work for what I am after.

 

Thank you.

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@nanat

 

I think something along these lines should work

 

Product Order per Customer =
CALCULATE (
    DISTINCTCOUNT ( 'Product Items Internal ID'[Products] ),
    'Product Items Internal ID'[status] = "invoiced"
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@nanat

 

I think something along these lines should work

 

Product Order per Customer =
CALCULATE (
    DISTINCTCOUNT ( 'Product Items Internal ID'[Products] ),
    'Product Items Internal ID'[status] = "invoiced"
)

Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad,

 

Thank you!

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.