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, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare 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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Kudoed Authors