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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
JFarq
Helper I
Helper I

Returning comma separated values from a filtered related table

Hi

 

I'm trying to create a measure similar to this:

 

Selected Suppress Labels =
CONCATENATEX(
        VALUES(Main_Inc_CC_And_tfs_SurveyResults[Suppress Label (big 14 2022 - big 14 2024 only)]),
        Main_Inc_CC_And_tfs_SurveyResults[Suppress Label (big 14 2022 - big 14 2024 only)],
        ", ",
	    Main_Inc_CC_And_tfs_SurveyResults[Suppress Label (big 14 2022 - big 14 2024 only)],
	    ASC
        )

 

This returns a comma separated list of the values in the Suppress Label (big 14 2022 - big 14 2024 only) field based on the current filter/slicer context of my report.

 

However, to simplify my raw data, i'd like to create a measure to pull the 'Suppress Label' values from a field in a different table connected via a 'CN-Q code' in a one-to-many relationship:

JFarq_0-1718558996683.png

 

I've tried to adapt a measure i've used to previously to pull data from connecting tables (with a calculate function):

 

Pull values from ReturnsData_21_22_to_23_24_table =
    CALCULATE (
        CONCATENATEX(
        VALUES(ReturnsData_21_22_to_23_24[Suppress Label]),
        ReturnsData_21_22_to_23_24[Suppress Label],
        ", ",
	    ReturnsData_21_22_to_23_24[Suppress Label],
	    ASC
        ),
        FILTER (
            ReturnsData_21_22_to_23_24,
            ReturnsData_21_22_to_23_24[CN-Q code] == MAXX ( Main_Inc_CC_And_tfs_SurveyResults, Main_Inc_CC_And_tfs_SurveyResults[CN-Q code] )
        )
    )

 

but it seems to return only one value instead of a comma separated list when more than one are selected in the Main_Inc_CC_And_tfs_SurveyResults[Suppress Label (big 14 2022 - big 14 2024 only)] field (and therefore the ReturnsData_21_22_to_23_24[Suppress Label] field):

JFarq_0-1718560473626.png

Apologies if this doesn't give enough information, i'll upload a .pbix file if necessary.

Any help would be much appreciated

 

JFarq

1 ACCEPTED SOLUTION
v-yohua-msft
Community Support
Community Support

Hi, @JFarq 

Maybe you can create measures and try the following DAX expression:

Unique Suppress Labels = 
    CONCATENATEX (
        DISTINCT ( 'Table'[Suppress Label] ),
        'Table'[Suppress Label],
        ", "
    )

Filtered Suppress Labels = 
    CALCULATE (
        [Unique Suppress Labels],
        FILTER (
            'Table',
            'Table'[CN-Q code] = MAXX ( 'Table', 'Table'[CN-Q code] )
        )
    )

 

Here is my preview:

vyohuamsft_1-1718680669230.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yohua-msft
Community Support
Community Support

Hi, @JFarq 

Maybe you can create measures and try the following DAX expression:

Unique Suppress Labels = 
    CONCATENATEX (
        DISTINCT ( 'Table'[Suppress Label] ),
        'Table'[Suppress Label],
        ", "
    )

Filtered Suppress Labels = 
    CALCULATE (
        [Unique Suppress Labels],
        FILTER (
            'Table',
            'Table'[CN-Q code] = MAXX ( 'Table', 'Table'[CN-Q code] )
        )
    )

 

Here is my preview:

vyohuamsft_1-1718680669230.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Moetazzahran
Resolver II
Resolver II

Hello @JFarq , 
Can you please upload a PBIX file to investigate the issue?

Thank you.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

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