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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
juncco888
Advocate I
Advocate I

Trouble with Measures when values are in seperate tables

Good Afternoon,

Forgive me as I am still a newbie.  Looking for some assistance with a measure. 

I want to create a measure that will display the distinct count of my existing clients who paid money that also show up in the insight query.

Basically  the measure would do this

IF Payments[Amt] >= 1 Then look for their phone number in the insight data, if it is there it counts as 1, if not nothing is added to the count.

Given this output:

output.png

 

The expected result would be 2 since only Jill and John are in insight and have paid money.

Here is what I tried:

Nr who Paid = IF(

    SELECTEDVALUE(Payments[Amt] >= 1,

    CALCULATE(SUM('Insight'[Contact Name]), ALL('Insight'[Contact Name]))),9999)

 

I have also tried related and relatedtable but am just generally having problems getting measures from values within different tables to work.

 

Structure of my tables:

tables.JPG

Model and relationships

model.png

 

of course the actual data set I am using is far larger than this and has thuosands of records.

 

Any advice or assistance would be greatly appreciated.  Additionally, if there is a good comprehensive book on creating measures in power BI I would be interested in your recommendations.

 

Thanks

Kyle

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Assuming Client has one row per unique client, try this:

Nr who Paid =
COUNTROWS (
    FILTER (
        Client,
        CALCULATE ( SUM ( Payments[Amt] ) ) >= 1 &&
        COUNTROWS ( CALCULATETABLE ( Insight ) ) >= 1
    )
)

 

This counts the rows in the Client table filtered with two conditions, Payments[Amt] >=1 and Insight has at least one matching row.

 

The CALCULATE and CALCULATETABLES are used here to do a context transition.

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Assuming Client has one row per unique client, try this:

Nr who Paid =
COUNTROWS (
    FILTER (
        Client,
        CALCULATE ( SUM ( Payments[Amt] ) ) >= 1 &&
        COUNTROWS ( CALCULATETABLE ( Insight ) ) >= 1
    )
)

 

This counts the rows in the Client table filtered with two conditions, Payments[Amt] >=1 and Insight has at least one matching row.

 

The CALCULATE and CALCULATETABLES are used here to do a context transition.

Thank you so much....   That worked perfect.  I appreciate your explanation as well because it will assist me with some other measures I am working on.

 

Thanks Again!

Kyle

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.