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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ihayes916
Frequent Visitor

If value is table, extract value(s) to csv, otherwise take value as is...

Greerings - 

I have a column that has both 'Table' and 'text' values. 

What I'd like to do is; 
If value type == table then, extract values to new column (myNewCustomColumn) as CSV.
else copy existing value to new column (myNewCustomColumn).

Can someone please help w/ this type of logic/formula?

Attached mockup of data for clarity.

 

Thanks!!!!

 

help.JPG 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ihayes916,

 

You can use below query to get expand values:

let
    Source = #table( type table [#"Component"=any], 
	{
		{"abc"},
                {"Cda"},
                {"AAA"},
		{#table({"Element"}, {{"esc"},{"Test"}})},
		{#table({"Element"}, {{"EAd"},{"BAA"}})}
	}),
    #"Added Custom" = Table.AddColumn(Source, "Expand", each if Value.Is([Component],type table) then Text.Combine([Component][Element],",") else [Component])
in
    #"Added Custom"

21.PNG

 

Regards,
Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @ihayes916,

 

Can you please share some sample data or pbix file for test?

Regards,

Xiaoxin Sheng

Hello @Anonymous!

 

Thanks for the reply.  Unfortunatly, I can't share the data and I've not found a way to recreate a small sample data set.  

I've attached a more refined version (screen shot) of my request.

 

Column1 (Component) is my source data.

Column2 (ExtractedValues) is the custom column that I am hoping to be able to create.  I've mocked up the result I'd like to see for each of the 3 scenarios.

 

Again, thanks for any help you might be able to provide!

 

 

help2.JPG

Anonymous
Not applicable

Hi @ihayes916,

 

You can use below query to get expand values:

let
    Source = #table( type table [#"Component"=any], 
	{
		{"abc"},
                {"Cda"},
                {"AAA"},
		{#table({"Element"}, {{"esc"},{"Test"}})},
		{#table({"Element"}, {{"EAd"},{"BAA"}})}
	}),
    #"Added Custom" = Table.AddColumn(Source, "Expand", each if Value.Is([Component],type table) then Text.Combine([Component][Element],",") else [Component])
in
    #"Added Custom"

21.PNG

 

Regards,
Xiaoxin Sheng

Thank you so much!!!!!  I came to a similar solution (albeit w/ one extra step) but I like yours better!!!

 

Truly appreciate it! 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.