Forum Discussion
Anonymous
4 years agoNot applicable
Return a concatenated string value based on calculation
Greetings everyone! I need help with the following moment: There are 2 columns: 1) Say the first column is a name of product 2) Second column is a part that belongs to a...
- 4 years ago
Anonymous
Please try= VAR CurrentProject = SELECTEDVALUE ( TableName[Name] ) VAR CurrentPartTable = CALCULATETABLE ( TableName, ALLEXCEPT ( TableName, TableName[Part #] ) ) RETURN IF ( COUNTROWS ( CurrentPartTable ) = 1, CurrentProject, CONCATENATEX ( CurrentPartTable, TableName[Name], ", ", TableName[Name], ASC ) )
tamerj1
Community Champion
4 years agoAnonymous
Please try
=
VAR CurrentProject =
SELECTEDVALUE ( TableName[Name] )
VAR CurrentPartTable =
CALCULATETABLE ( TableName, ALLEXCEPT ( TableName, TableName[Part #] ) )
RETURN
IF (
COUNTROWS ( CurrentPartTable ) = 1,
CurrentProject,
CONCATENATEX ( CurrentPartTable, TableName[Name], ", ", TableName[Name], ASC )
)- Anonymous4 years agoNot applicable
I am sorry, silly me. Your solution actually works, it was me who didn't make it work right. THANK YOU!
- tamerj14 years ago
Community Champion
Anonymous
Happy to hear that. Thank you for marking my reply as acceptable solution- Anonymous4 years agoNot applicable
Would You explain your solution to me so I could get it right, please? Like I am 5 yo would be more preferrable...
- Anonymous4 years agoNot applicable
It return the list of every occurence now, but that's a good way to start?
- tamerj14 years ago
Community Champion
Anonymous
Didn't know they are repeated. Please use= VAR CurrentProject = SELECTEDVALUE ( TableName[Name] ) VAR CurrentPartTable = CALCULATETABLE ( TableName, ALLEXCEPT ( TableName, TableName[Part #] ) ) VAR ProjectNames = DISTINCT ( SELECTCOLUMNS ( CurrentPartTable, "@Name", TableName[Name] ) ) RETURN IF ( COUNTROWS ( ProjectNames ) = 1, CurrentProject, CONCATENATEX ( ProjectNames, [@Name], ", ", [@Name], ASC ) )