How to Display Multiple Rows in a Single Cell of a Matrix or a Table

How can I condense multiple rows into a single cell in a Matrix or a Table?

Obviously, it is easy to display all details like you see below:

But what if for every product I just want to know what countries it is selling in and what channels are used? Like how it is displayed below:

Turns out we have to write a bit of DAX but thankfully, not much at all.

Click here to download the PBIX model.

You can get the detailed explanation from my video but here are the DAX calculations that I had to create to enable this use-case.

Product Channels = 
IF(
    HASONEVALUE('Product'[Product]),
    CONCATENATEX
    (
        Channel, 
        "• " & Channel[Channel], 
        UNICHAR(10)&UNICHAR(13) , 
        Channel[Channel]
        )
)
Product Countries = 
IF(
    HASONEVALUE('Product'[Product]),
    CONCATENATEX
    (
        Country, 
        "• " & Country[Country], 
        UNICHAR(10)&UNICHAR(13) , 
        Country[Country]
        )
)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s