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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

How to create new columns based on value from another column

Hi all, 

 

I would like to create a ew column where results are shown based on one value from a list of values from another column. For example, if there are 10 item numbers each for 7 regions, that would be 70 item numbers in total. But I would like to create 7 diferent columns, one for each region, like item number region A, item number region B, etc.. Please tell me how I can do it. Thank you. 

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

Hi , @Anonymous 

According to your description, do you mean you want to convert your table like this?

vyueyunzhmsft_0-1672887623068.png

If this , it can be realized in Power Query Editor.

We can put this M code in "Advanced Editor" to refer to :

vyueyunzhmsft_1-1672887660838.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc+tDoAgFIDRd7mZIBfk5xGsVkZkzqAW338aZGPuq6edUmRt236dVowsdzusVPM3BXNgHmweTD8LYBEsgWUwOw3oOlpCJXSEnnDc+I6BMBImwgyo76g+", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Region = _t, Item = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Region", type text}, {"Item", type text}}),
    Custom1 = Table.Group(#"Changed Type","Region",{"test",(x)=>x[Item]}),
    Custom2 = Table.FromColumns(Custom1[test],Custom1[Region])
in
    Custom2

Then we can get the table we want to :

vyueyunzhmsft_2-1672887685309.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

3 REPLIES 3
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description, do you mean you want to convert your table like this?

vyueyunzhmsft_0-1672887623068.png

If this , it can be realized in Power Query Editor.

We can put this M code in "Advanced Editor" to refer to :

vyueyunzhmsft_1-1672887660838.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc+tDoAgFIDRd7mZIBfk5xGsVkZkzqAW338aZGPuq6edUmRt236dVowsdzusVPM3BXNgHmweTD8LYBEsgWUwOw3oOlpCJXSEnnDc+I6BMBImwgyo76g+", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Region = _t, Item = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Region", type text}, {"Item", type text}}),
    Custom1 = Table.Group(#"Changed Type","Region",{"test",(x)=>x[Item]}),
    Custom2 = Table.FromColumns(Custom1[test],Custom1[Region])
in
    Custom2

Then we can get the table we want to :

vyueyunzhmsft_2-1672887685309.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Idrissshatila
Super User
Super User

Hello,

You could do a measure that counts the item numbers and then visualise this measure by region name so it would show you the count of item numbers for each region, instead of creating 7 columns.

 

If I answered your question, please mark my post as solution so it would appear to others, Appreciate your Kudos👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Anonymous
Not applicable

Thank you for your answer @Idrissshatila .I actually need to create columns because that is the requirement of the customer, as they want to see separate lists of item numbers in a table format, specific to each region. Hence the question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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