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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
lukmtb08
Helper III
Helper III

Power Query IF

Dear community, 

 

in Power Query I am multiplying a column with 1000:
= Table.TransformColumns(#"Extract 22 ACT & YTD_", {{"Value", each _ * 1000, type number}})

I would like to adjust the expression. If the column "Metric" contains the text values "Pieces" OR "Quantities", the column "Value" should not be multiplied. 


1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @lukmtb08 

You cannot add conditional directly in Table.TransformColumns, you can add columns first then delete the original value.

e.g 

= Table.AddColumn(#"Extract 22 ACT & YTD_", "Values", each if Text.Contains([Metric], "Pieces") or Text.Contains([Metric], "Quantities") then [Value]*1000 else [Value])

vxinruzhumsft_0-1677205094807.png

Best Regards!

Yolo Zhu

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

1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Hi @lukmtb08 

You cannot add conditional directly in Table.TransformColumns, you can add columns first then delete the original value.

e.g 

= Table.AddColumn(#"Extract 22 ACT & YTD_", "Values", each if Text.Contains([Metric], "Pieces") or Text.Contains([Metric], "Quantities") then [Value]*1000 else [Value])

vxinruzhumsft_0-1677205094807.png

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors