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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Tyler_Rinker
Frequent Visitor

Concatenate the values of a dimenstion field that is connected to (dim[field] -> brg <-> dim -> fct

My data is about workers and their clock in and out times at different buildings.  These building have multiple descriptive tags associated with them.  I am attempting to create a table visual that uses fields from a fact (fct_check_in) and dimension tables.  It all goes well until I want to include a concatenated field (building_tags) from a dimension table (dim_building_tag) that is connected to another dimension table (dim_building) via a bridge table (brg_building_to_building_tags) used to address a many to many relationship.  

Tyler_Rinker_0-1727180141849.png

I am using a measure to try to make this column in the table visual so that the results can be dynamic (only some tags in the tag slicer might be selected for example).

I tried:

concatenated_building_tags =
CONCATENATEX(
    VAR CurrentBuildingID = SELECTEDVALUE(fct_check_in[building_id])
    RETURN
    FILTER(
        brg_building_to_building_tag,
        brg_building_to_building_tag[building_id] = CurrentBuildingID
    ),
    RELATED(dim_building_tag[building_tag]),
    "; "
)

but this results in no rows being returned.  I also tried:

concatenated_building_tags_3 =
CONCATENATEX(
    VALUES(dim_building_tag[building_tag]),
    dim_building_tag[building_tag],
    "; "
)

But that results in extra rows being returned with all tags on every row. 

Tyler_Rinker_2-1727181263944.png

 

How can I concatenate just the tags associated with that building for each row in alphabetical order as seen in the following image?

Tyler_Rinker_1-1727181139487.png

 MWE pbix concatenatex_fct_dim_brg_dim.pbix 

1 ACCEPTED SOLUTION

I did change one of the relationships as the building_id (number) was related to the building name. 

Here is the pbix.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

6 REPLIES 6
jgeddes
Super User
Super User

Here is an alternative measure that may also work for you.

Measure = 
var _selectedBuilding = 
SELECTEDVALUE(fct_check_in[building_id])
var _filteredTable =
SELECTCOLUMNS(
		FILTER(
			brg_building_to_building_tag,
			brg_building_to_building_tag[building_id] = _selectedBuilding
		),
		"__value", RELATED(dim_building_tag[building_tag])
	)
var _result = 
CONCATENATEX(
    _filteredTable,
    [__value],
    "; ",
    [__value],
    ASC
)
Return
_result

jgeddes_0-1727185065252.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@jgeddes I tried your approach and pasted in exactly as you had it but it results in 0 rows returned in the table visual.  I suspect you tweaked the model too? Your output image looks like what I'm after.  

Tyler_Rinker_0-1727198759217.png

 

I did change one of the relationships as the building_id (number) was related to the building name. 

Here is the pbix.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Ah silly connection error on my part.  Works well!  Thank you!

rajendraongole1
Super User
Super User

Hi @Tyler_Rinker -concatenated tags are sorted alphabetically in Power BI, modify your DAX formula to explicitly include the sorting order in CONCATENATEX. 

use below logic

concatenated_building_tags_sort =
CONCATENATEX(
    VALUES(dim_building_tag[building_tag]),
    dim_building_tag[building_tag],
    "; ",
    dim_building_tag[building_tag],
    ASC
)

 

rajendraongole1_0-1727182833209.png

 

Attached pbix file FYR. Hope it helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@rajendraongole1 that tackles the sorting part but the harder part is making sure the right building tags go with the right bulding.  Each building has at most 3 tags but the current DAX will make 4 tags (all tags are shown).  If you see my last image it shows the tags I'd expect per row with All selected in the available slicers for buildings and uilding tags.  Additionally this current measure causes additional rows without buildings to be created (which can be fixed with a table filter but usually extra rows means my DAX is not ideal).

Preview
 
 
 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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