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

Transform unique values in a column as new columns

Hi Community

I hope you can help with the issue I have been sttruggling with

I am trying to extract the unique values from a column in a table and include them as new columns in the same table (I have been able to do this), and I need that correspondant value based on the Record ID to be tranformed in the respective column as 1 or 0. I do not want to do this task as "Conditional Column" because there could be more than 1,000 unique values, so it will take some time to do it this way.

 

Basically, what I need is from a table as per below

Capture.PNG

 

Transform into a table as per below

Capture1.PNG

 

I hope this makes sense and you can help me with it

Many Thanks

1 ACCEPTED SOLUTION
Avantika-Thakur
Solution Supplier
Solution Supplier

Hi @Anonymous ,

You can try with the following steps in Power Query editor :

1) First you will have to create a column in your table which holds value "1" for all the rows

AvantikaThakur_0-1668489765997.png

2) Click on the Type column and select Pivot Column option from Transform ribbon. Select the "Value" column in "Values Column" section and Count(All) under "Aggregate Value Function"

AvantikaThakur_2-1668490605511.png

3) You will get the required result as below :

AvantikaThakur_3-1668490708041.png

 

Hope this answers your query!

 

Please accept the solution if this answers your question.

Thanks,

Avantika Thakur

 

 

 

View solution in original post

4 REPLIES 4
Avantika-Thakur
Solution Supplier
Solution Supplier

Hi @Anonymous ,

You can try with the following steps in Power Query editor :

1) First you will have to create a column in your table which holds value "1" for all the rows

AvantikaThakur_0-1668489765997.png

2) Click on the Type column and select Pivot Column option from Transform ribbon. Select the "Value" column in "Values Column" section and Count(All) under "Aggregate Value Function"

AvantikaThakur_2-1668490605511.png

3) You will get the required result as below :

AvantikaThakur_3-1668490708041.png

 

Hope this answers your query!

 

Please accept the solution if this answers your question.

Thanks,

Avantika Thakur

 

 

 

Anonymous
Not applicable

Hi Avantika


Thanks for that, it works beatifully. Just on final question. Is it possible not to include the prefix "1.2"?

 

Regards,

 

Carlos

Hi @Anonymous ,

 

"1.2" is just the datatype of the column which is currently set to decimal number and you can change the data type to any other format as per requirement by clicking on the "1.2" on every column.

 

Thanks,

Avantika

Anonymous
Not applicable

Ops, my bad

 

Forgot my comment

 

Many Thanks for the quick reply

 

Regards,

 

Carlos

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.