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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors