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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Tom123456789
New Member

Power Query Forumla

Hello,

 

Would anyone be able to turn the following two excel formulas into power query formulas?

 

=IF(AND(ISNUMBER(VALUE(LEFT($K148,2))),MID($K148,3,1)="C"),"CHANGE",IF(AND(ISNUMBER(VALUE(LEFT($K148,3))),MID($K148,4,1)="C"),"CHANGE",""))

 

=IF(MID($K148,3,1)="C","0"&LEFT($K148,2),IF(MID($K148,4,1)="C",LEFT($K148,3),""))

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Tom123456789 ,

 

The first formula in Power Query looks like this:

= if Value.Is(Value.FromText(Text.Start([Column1],2)),type number) and Text.Middle([Column1],3,1)="C" then "CHANGE" else if Value.Is(Value.FromText(Text.Start([Column1],3)),type number) and Text.Middle([Column1],4,1)="C" then "CHANGE" else ""

vstephenmsft_0-1672304241450.png

The second formula looks like:

= if Text.Middle([Column1],3,1)="C" then "0"&Text.Start([Column1],2) else if Text.Middle([Column1],4,1)="C" then Text.Start([Column1],3) else ""

vstephenmsft_1-1672304526432.png

 

 

 

Best Regards,

Stephen Tao

 

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
Anonymous
Not applicable

Hi @Tom123456789 ,

 

The first formula in Power Query looks like this:

= if Value.Is(Value.FromText(Text.Start([Column1],2)),type number) and Text.Middle([Column1],3,1)="C" then "CHANGE" else if Value.Is(Value.FromText(Text.Start([Column1],3)),type number) and Text.Middle([Column1],4,1)="C" then "CHANGE" else ""

vstephenmsft_0-1672304241450.png

The second formula looks like:

= if Text.Middle([Column1],3,1)="C" then "0"&Text.Start([Column1],2) else if Text.Middle([Column1],4,1)="C" then Text.Start([Column1],3) else ""

vstephenmsft_1-1672304526432.png

 

 

 

Best Regards,

Stephen Tao

 

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

Thank you very much!

HotChilli
Super User
Super User

Hi,

You're probably going to get about 5 minutes of someone's time so it might be better to provide some sample data , showing the desired result with an explanation of how to get there.

That will improve the chances of getting a good response.

 

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.

Top Solution Authors