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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
CMoneyMoore
New Member

Dax formula returning duplicate items

Hey there! 

 

Hoping I get some help with a measure I am working on. My ultimate goal is to get a concatenated list of contacts returned based on the data uploaded to a particular report. 

 

Getting more detailed, I have three tables uploaded in a report that is going to act as a tool for our team. The data file that is uploaded is provided by a customer, and one of the functions of the report is providing a list of providers that can service a particular customer based on the LANES of the shipments. 

 

My data is connected this way:

- Data file from the customer ('Data') > has a column called "Lane"

- 'Carrier Assignments (Master)' > has a column called "LANE" as well.

- 'Carrier Assignments (Master)' matches the LANE with a SCAC code (column called "SCAC")

- Finally a table called "Contacts" with a column called "SCAC"

 

Ideally what is being returned is a single string of contacts - however what is being currently returned is a list of contacts for every unique lane, resulting in many duplicates. I thought it would be easier, since I have a bar graph that shows the providers and what % of the shipments they can handle.

 

Here is the current measure:

 

Regional Providers =
CONCATENATEX(
    VALUES('Data'[Lane]),
    --Iterate over unique Lane values
    CALCULATE(
        CONCATENATEX(
            DISTINCT(
                FILTER('Contacts','Contacts'[SCAC] IN(
                SELECTCOLUMNS(
                    RELATEDTABLE('Carrier Assignments (Master)'),
                    "SCAC",
                    'Carrier Assignments (Master)'[SCAC]
                )
            )
            )),'Contacts'[Contact]
        )
    )
)
 
Any help is appreciated!
1 ACCEPTED SOLUTION

Hi,

I created this calculated column formula in the Data Table

Contact = related(Contacts[Contact])

and then wrote this measure

Measure = CONCATENATEX(VALUES(Data[Contact]),Data[Contact],", ")
Ashish_Mathur_0-1713318373010.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
CMoneyMoore
New Member

Sure! 

Data Table ex:

Ship IDLane
1AR_CA
2CA_CA
3ME_AR
4AR_CA
5ME_CA

 

SCAC Assignments ex:

LaneScac
AR_CAABCD
CA_CAEFGH
ME_ARIJKL
AR_OKMNOP
ME_CAQRST

 

Contacts ex:

ScacContact
ABCDJohn.Smith@abcd.com
EFGHJack.Moore@efgh.com
IJKLJane.Smith@ijkl.com
MNOPJill.White@mnop.com
QRSTLeia.Organa@qrst.com

 

Sample return data:

Desired Result:
John.Smith@abcd.com;Jack.Moore@efgh.com;Jane.Smith@ijkl.com;Leia.Organa@qrst.com

 

No duplicates, only includes applicable contacts for lanes provided. 

 

Let me know if there's anything else I can provide!

Hi,

I created this calculated column formula in the Data Table

Contact = related(Contacts[Contact])

and then wrote this measure

Measure = CONCATENATEX(VALUES(Data[Contact]),Data[Contact],", ")
Ashish_Mathur_0-1713318373010.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result in a simple Table format.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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