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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Rahul66303
Frequent Visitor

How to create columns dynamically based on other column ?

Hi,

 

I need help on creating columns based on the column's values as below, I have column Tags in Table1 and values are delimeter based (Tag (This need to be column) : Val (This shoud be value).

 

Table1 :

Tags
Tag1:Val1;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val2;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val1;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val3;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val1;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val2;Tag2:Val2;Tag3:Val1;Tag4:Val1

 

This need to be transform as :

 

Tag1Tag2Tag3Tag4
Val1Val2Val1Val1
Val2Val2Val1Val1
Val1Val2Val1Val1
Val3Val2Val1Val1
Val1Val2Val1Val1
Val2Val2Val1Val1

 

i am able to spilt values from Tags column but not able to dynamically renamed the column 

 

Thanks,

Rahul

1 ACCEPTED SOLUTION

Hi @Rahul66303,

 

Please check out the demo here. The solution depends on GUI operations. No code is needed.

How_to_add_columns_dynamically_to_table_based_on_text_from_another_column

 

Best Regards,

Dale

Community Support Team _ Dale
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
Rahul66303
Frequent Visitor

Hi,

 

Need to understand if below scenario is possible in Power BI desktop.

 

I have a table where one of the column (Tags) have delimiter based values as below, what i need to do is dynamically it should add 4 columns Tag1 as column1 and Val1,Val2,Val3 ... as values for Tag1 and similar structure for Tag2, Tag3 and Tag4.

Basically Tags contain ; delimeter for Tag and inside tag : delimeter should be used for column name and values.

 

Tags
Tag1:Val1;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val2;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val1;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val3;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val1;Tag2:Val2;Tag3:Val1;Tag4:Val1
Tag1:Val2;Tag2:Val2;Tag3:Val1;Tag4:Val1

 

Dynamically it should transform as per below, i know we can rename the column but i want it should give me dynamic name based on input in above Tags column .

 

Tag1Tag2Tag3Tag4
Val1Val2Val1Val1
Val2Val2Val1Val1
Val1Val2Val1Val1
Val3Val2Val1Val1
Val1Val2Val1Val1
Val2Val2Val1Val1

 

Appreciate it if some one can help asap.

 

Thanks,

Rahul

Hi @Rahul66303,

 

Please check out the demo here. The solution depends on GUI operations. No code is needed.

How_to_add_columns_dynamically_to_table_based_on_text_from_another_column

 

Best Regards,

Dale

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

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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