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

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

Reply
Mariamawit96
Frequent Visitor

How to fill all rows of a column based on a value form a row in another column [Power Query Editor]

Hello, 

 

I am trying to create a custom column to return the names of all companies that have responded "False" and transform the names into ex. anonymous company if they have responded "True" to the consent question  BUT also to the rest of the questions, using Power Query Editor (i cannot use DAX). i have a table with one column containing all the  questions and one column containing all the answers  and a column with the company name. 

 

I have tried using the IF function to first create a column "consent" with the responses True & False:

 

each if [question_ID] = ".question66" then [Response] else ""

 

 

 

then i created another column "Label" to lable them with the name of the company if they responded False and as "anonymous company" if they responded True:

 

 

 

each if [consent]="True" then "anonymous company" else if [consent]="False" then [companyName] else "" )

 

However, even if the formula works i have the issue of having blank row for the other questions, instead of having them filled out 

 

question_IDResponseCompany NameConsentLabel
.question66TrueAppleTrueanonymous company
.question77xxApple  
.question5xxApple  

 

whereas what i would like is the following:

 

question_IDResponseCompany NameConsentLabel
.question66TrueAppleTrueanonymous company
.question77xxApple

True

 anonymous company
.question5xxAppleTrue anonymous company

 

can anyone help? Thank you.

 

 

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

Ok, lets try adding an index column for each Company Name using Group By (select All Rows as the Operation)

jgeddes_0-1664904490980.png

With the resulting table of company names add an index column starting at 1

you should end up with something like

jgeddes_1-1664904557636.png

Expand the tables in the count column, deselect Company Name and Use Original Column Name as Prefix

jgeddes_2-1664904618429.png

Now we can add a column

jgeddes_3-1664904734576.png

Now we can fill down to populate the label column

jgeddes_4-1664904802625.png

And we should end up with

jgeddes_5-1664904822845.png

Hope this gets you going in the right direction.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
jgeddes
Super User
Super User

Ok, lets try adding an index column for each Company Name using Group By (select All Rows as the Operation)

jgeddes_0-1664904490980.png

With the resulting table of company names add an index column starting at 1

you should end up with something like

jgeddes_1-1664904557636.png

Expand the tables in the count column, deselect Company Name and Use Original Column Name as Prefix

jgeddes_2-1664904618429.png

Now we can add a column

jgeddes_3-1664904734576.png

Now we can fill down to populate the label column

jgeddes_4-1664904802625.png

And we should end up with

jgeddes_5-1664904822845.png

Hope this gets you going in the right direction.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you very much for your help, i have applied all the steps that you have outlined however, the formula returns all blank values:

Mariamawit96_0-1664960492397.png

the formula i used is (translated in english) :

= Table.AddColumn(#"Expanded Count", "NEW_label", each if [questionID] = ".question66" and Text.Upper([response]) = "True" then "anonymous company" else if [questionID] = ".question66" and Text.Upper([response])="False" then [company name] else null)

 

how can i solve it? thank you again.

I wrote Text.Upper into the formula as I was not sure if your response values were typed in by hand or if they were computer generated. It helps capture all values that could be typed. But in order for it to work you have to make sure to follow the Text.Upper statement with a value that is in upper case. So in this instance make sure you have Text.Upper([response]) = "TRUE" (as opposed to "True") You will have to edit the false part to FALSE as well.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





okay thank you. 

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.