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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MegaOctane1
Helper I
Helper I

Need to compare two tables and count number of customers not in balance

I have three tables.

Table 1 CustomerMaster:

CustomerNumberCustomer Name
100Apple
101Microsoft

 

Table 2, Open invoices in ERP:

CustomerNumberInvoiceAmount
10031000
10042000
10153000

 

Table 3, Open invoices InvoicePartner:

CustomerNumberInvoiceAmount
10031000
10153000


Skjermbilde 2023-10-15 121334.png

Relationship is on KundeNummer in each table. 

 

I have a measure to calculate the difference of these two tables. 
Measure is:

Difference = VAR _DIFF_CHECK = [SUM ERP]-[SUM InvoicePartner] Return IF(_DIFF_CHECK<>0, _DIFF_CHECK)


it returns this:

CustomerNumberDifference
1002000
1010

 

How can i create a card visual/measure to say that number of customers with difference is 1?

i am not able to do a countIF(Difference<>0)

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

To create a card visual or measure that displays the number of customers with differences in the "Difference" measure, you can follow these steps:

  1. Create a new measure that calculates the count of customers with differences:

CountOfCustomersWithDifferences = COUNTROWS(FILTER(CustomerMaster, [Difference] <> 0))

 

This measure counts the rows in the "CustomerMaster" table where the "Difference" measure is not equal to 0.

  1. Add a card visual to your report.

  2. In the card visual, use the "CountOfCustomersWithDifferences" measure as the value to display.

Now, your card visual will show the number of customers with differences in their invoices. If the "Difference" measure is not equal to 0 for a customer, it will be counted in this card visual. In your example data, it will show "1" because there is one customer with a difference (CustomerNumber 100).

 

View solution in original post

2 REPLIES 2
Dangar332
Super User
Super User

Hi, @MegaOctane1 

try below with same relationship which you mention
make measure in customer master table 
 
diff =
var a =SUM('invoice partner'[Amount])
var b = SUM('open invoice'[Amount])
return
ABS(a-b)
 
Dangar332_0-1697526932209.png

 

 
and use customer number  in table visuals from your master table 
 

 

 

 

123abc
Community Champion
Community Champion

To create a card visual or measure that displays the number of customers with differences in the "Difference" measure, you can follow these steps:

  1. Create a new measure that calculates the count of customers with differences:

CountOfCustomersWithDifferences = COUNTROWS(FILTER(CustomerMaster, [Difference] <> 0))

 

This measure counts the rows in the "CustomerMaster" table where the "Difference" measure is not equal to 0.

  1. Add a card visual to your report.

  2. In the card visual, use the "CountOfCustomersWithDifferences" measure as the value to display.

Now, your card visual will show the number of customers with differences in their invoices. If the "Difference" measure is not equal to 0 for a customer, it will be counted in this card visual. In your example data, it will show "1" because there is one customer with a difference (CustomerNumber 100).

 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.