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
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
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.

Top Solution Authors