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
joshua1990
Post Prodigy
Post Prodigy

Calculated column with a entries for each order from different table

Hi all!

I have a Sales Master table that contains for each order 1 row:

Order Nr Value
1 5
2 6

 

Then I have a transaction table with multiple rows for each sales order:

Order Nr Text
1 ABC
1 ABC
1 ADF
1 KIG
2 B

 

Now I would like to add a calculated column to the sales master that contains all distinct text entries for each order from the second table, seperated with a commata.

 

How is this possible?

1 ACCEPTED SOLUTION

@joshua1990 

You are right. Please try

NewColumn =
CONCATENATEX (
    CALCULATETABLE ( VALUES ( transaction[Text] ) ),
    transaction[Text],
    UNICHAR ( 10 ),
    transaction[Text], ASC
)

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1661817638814.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

tamerj1
Super User
Super User

Hi @joshua1990 

assume that you have a one to many relationship between the two tables based on [Prder Nr] columns then

NewColumn =
CONCATENATEX (
    RELATEDTABLE ( transaction ),
    transaction[Text],
    UNICHAR ( 10 ),
    transaction[Text], ASC
)

@tamerj1 : Thanks a lot! Yes, there is a 1:n relation between both tables.

It works, but not in the way I would like to see. I get as a string all values now, but I would like to get just distinct / unique values. How can I exclude duplictes here?

@joshua1990 

You are right. Please try

NewColumn =
CONCATENATEX (
    CALCULATETABLE ( VALUES ( transaction[Text] ) ),
    transaction[Text],
    UNICHAR ( 10 ),
    transaction[Text], ASC
)

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.

Top Solution Authors