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! Learn more

Reply
Mangnuel
Helper I
Helper I

Replace any Value/Text/String by number

Hello everyone,

I need your help again, thanks in advance.

While importing an excel-file via power query into power bi
we need to secure that within two differnt columns the inputs are always the same.
The bleonging cells could contain a Text, maybe a number or just one letter.
Doesn't really matter what's within the cells, as long as it is not empty I would like to replace the input of the cell with a number.
So how can I check if a cell is not empty in generell and replace or overight the input with a defined static variable.

Many Thanks in advance

Raphael

1 ACCEPTED SOLUTION
Akash_Varuna
Super User
Super User

hi try these formulas

                                 1 In Power Query, use the formula
                                    if Text.Trim([Column1]) <> "" then 1 else [Column1] in a Custom Column to replace non-                                    empty cells in Column1 with a static number like 1.

                                  2 To overwrite a column directly, use

                                     Table.TransformColumns(Source, {{"Column1", each if Text.Trim(_) <> "" then 1 else _,                                           type number}}).
if this post helps please accept as this solution and give a kudos

 

 

View solution in original post

5 REPLIES 5
v-karpurapud
Community Support
Community Support

Hi @Mangnuel 

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @Mangnuel 

Hope you are doing well!

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

 

 

v-karpurapud
Community Support
Community Support

Hi @Mangnuel 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

 

v-karpurapud
Community Support
Community Support

Hi @Mangnuel 

Thanks for reaching out to Microsoft Fabric Community Forum.

We found the answers provided by @Akash_Varuna works perfectly. Please consider trying them out to check if they work for you. 

I have recreated your scenario using sample data it works fine .

 vkarpurapud_1-1737616982802.png

If they work, please consider marking them 'Accept as Solutionand give a KUDOS.
Thank You.

 

 

 

 

         

 

 

 

Akash_Varuna
Super User
Super User

hi try these formulas

                                 1 In Power Query, use the formula
                                    if Text.Trim([Column1]) <> "" then 1 else [Column1] in a Custom Column to replace non-                                    empty cells in Column1 with a static number like 1.

                                  2 To overwrite a column directly, use

                                     Table.TransformColumns(Source, {{"Column1", each if Text.Trim(_) <> "" then 1 else _,                                           type number}}).
if this post helps please accept as this solution and give a kudos

 

 

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.