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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Calculated Column return column Header Title if a condition is met - ie cell has a 1 in it.

Hi there

 

I have a data set from a recent working from home survey that requested respondents to select their top 3 from some 5 options.

 

The survey data set looks like below and i'm keen to reflect in a calculated column (1, 2 and 3) the Header Title (ie #1 Option, #2 Option, etc)

 

I considered some sort of nested if formula, but i need for the dax to look across all cells under the option and then return the header title.

 

Is this possible??

 

#1 Option#2 Option#3 Option#4 Option#5 Option123
2 3 1#5 Option#1 Option#3 Option
 1 23#2 Option#4 Option#5 Option
312  #2 Option#3 Option#1 Option

 

Cheers

Tim 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

As amitchandak said, do unpivot columns on your '# option' fields to convert them to attribute and value. Then you can create a matrix visual with name on 'row', value on 'column', attribute on value field to achieve your requirement.

85.gif8.png
Regards,
Xiaoxin Sheng

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , The data is not making it clear.

I think Unpivot or transpose should help you to put data in a better format

https://radacad.com/pivot-and-unpivot-with-power-bi

https://yodalearning.com/tutorials/power-query-helps-transposing-data/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

attempt #3

 

current data set...

 

 Survey Question. From the 5 options, rank your Top 3 challenges whilst working from home?
Name#1 Option#2 Option#3 Option#4 Option#5 Option
Employee 12 3 2
Employee 2 1 23
Employee 3312  

 

I'd like to have a calculated Column for each Ranking... ie #1 challenge, #2 Challenge and #3 Challenge reflecting the Option selected by the Employee.

 

Using the data set above, the calculated colums would look like the following:

 

Employee Name

#1 Challenge#2 Challenge#3 Challenge
Employee 1#5 Option#1 Option#3 Option
Employee 2#2 Option#4 Option#5 Option
Employee 3#2 Option#3 Option#1 Option

 

third times a charm ??

 

Tim 

Anonymous
Not applicable

Hi @Anonymous,

As amitchandak said, do unpivot columns on your '# option' fields to convert them to attribute and value. Then you can create a matrix visual with name on 'row', value on 'column', attribute on value field to achieve your requirement.

85.gif8.png
Regards,
Xiaoxin Sheng

parry2k
Super User
Super User

@Anonymous can you paste the data and expected output as separate instead side by side, it is hard to understand what is going on there, 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

thanks... here's attempt 2 🙂

 

my data set as it currently looks, with 5 options and employee's selection of their Top 3.

 

Name#1 Option#2 Option#3 Option#4 Option#5 Option
Employee 12 3 1
Employee 2 1 23
Employee 3312  

 

I'm keen to create some calculated columns that reflect the Header Title corresponding to the Employee's selection.

 

Calc Columns>>123
Employee 1#5 Option#1 Option#3 Option
Employee 2#2 Option#4 Option#5 Option
Employee 3#2 Option#3 Option#1 Option

 

chasing a forumla that will return the Header Title corresponding to the number in the cell beneath it.  

 

hope this makes more sense.

Tim 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors