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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
KyawMyoTun
Helper III
Helper III

Fuzzy measure in dax not in power query

Dear Experts,
 I am looking for a help for my issue with consolidated customer sales as below.
Sale (fact table)

Customer IDCustomer NameInvoice noSale AmountInvoice Date
1001Flower Co.,Ltd1000011001/2/2024
1002Flower Company Limited1000022001/3/2024
1003Xray Inc.Ltd1000031001/3/2024
1003Xray Inc1000045001/4/2024

In this sale table, the Customer ID 1001 and 1002 are the same customer but wrongly opened as new customer.
And then, the Customer ID 1003 has two different names but the latest one is the correct one.
So, I created a new table by Customer Name as below to extract by the correct customer name and sale amount.

Customer Name
Flower Co.,Ltd
Xray Inc

Although fuzzy matching in power query is working properly, it takes a lot of time consuming.
So, I'd like to ask you a help to do it by dax as the below final table.

Customer NameSale AmountInvoice DateFuzzy Customer Name
Flower Co.,Ltd1001/2/2024Flower Co.,Ltd
Flower Co.,Ltd2001/3/2024Flower Company Limited
Xray Inc1001/3/2024Xray Inc.Ltd
Xray Inc5001/4/2024Xray Inc

Thanks, and I am highly appripriate for your help.

Regards,
KMT

4 REPLIES 4
v-weiyan1-msft
Community Support
Community Support

Hi @KyawMyoTun ,

 

Based on the sample and description you provided, Please try the following steps:
1. You can create a new table as follows.

vweiyan1msft_0-1706691406647.png

There is a one-to-one relationship between the two tables.

vweiyan1msft_1-1706691422754.png

2. Use the following code to create a Calcualted table.

Table 3 = 
NATURALINNERJOIN (
    NATURALINNERJOIN ( 'Table 2', VALUES ( 'Table'[Sale AmountInvoice] ) ),
    VALUES ( 'Table'[Date] )
)

Result is as below.

vweiyan1msft_2-1706691481774.png


Best Regards,
Yulia Yan

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dear @v-weiyan1-msft ,

  Thanks a lot for your reply and help.
But the sale table contains multiple transactions of each customer(But I am sorry that I only put less transactions). The sale table should be like below.

Customer NameSale AmountInvoice DateFuzzy Customer Name
Flower Co.,Ltd1001/2/2024Flower Co.,Ltd
Flower Co.,Ltd2001/3/2024Flower Company Limited
Xray Inc1001/3/2024Xray Inc.Ltd
Xray Inc5001/4/2024Xray Inc
Xray Inc4001/5/2024Xray Inc
Flower Co.,Ltd3001/5/2024Flower Co.,Ltd

So, we can't make 1 to 1 relationship because sale table has multiple transctions for individual customer.
Please take a look into this and let me know if you find some alternative way on this.

Regards,
KMT

lbendlin
Super User
Super User

Have two reference tables

 

First, for ID mapping

 

Customer ID Ultimate Customer ID
1001 1001
1002 1001

 

And another on for names  

Customer Name Ultimate Customer Name
Flower Co.,Ltd Flower Company Limited
Xray Inc.Ltd Xray Inc.

 

Or combine them into a single reference table.  That reference table should reside outside of Power BI, for example an Excel file on a SharePoint. That way you clean up the data without having to modify the report.

 

Dear @lbendlin,
Thanks a lot for your help and reply.
The mapping should be mostly based on the customer name actually.
I am not so clear on your answer and can you please explain a litter more details. Thanks.

Regards,
KMT

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.