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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors