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
leroy773
Helper II
Helper II

new column that calculates value of a row based on text in the row

All,

 

I am attempting to add an if function to a column to calculate quantity of a row based on part description.  I have tried search and contains functions to no success.  Anytime the part name contains partial I would like to multiply by one. since all other parts are whole, would like to multiply by 4.  Any feedback will be appreciated.

 

Part NameQtyTotal
a, partial1='Qty'*1
a, whole.5='Qty'*4
b, partial1='Qty'*1
b, whole.75='Qty'*4
1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

@leroy773  working fine for me: please use in the calculated column

 

 

CM.PNG

 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

 

@leroy773 

Calculated column measure :

 

Measure=SWITCH(TRUE(),FIND("partial",[Part Name],1,0)>=1,[Qty]*1,[Qty]*4)

 

 

Thank you for the prompt feedback, that calculation multiplies all qty by 1, even when partial is in the part name.  Any other thoughts.

Anonymous
Not applicable

 

@leroy773  working fine for me: please use in the calculated column

 

 

CM.PNG

 

Thanks that worked, not sure why it did nto work.  Must of entered something incorrectly

 

Anonymous
Not applicable

Have U used this Measure: Measure=SWITCH(TRUE(),FIND("partial",[Part Name],1,0)>=1,[Qty]*1,[Qty]*4)
amitchandak
Super User
Super User

@leroy773 , Create a new column like

New column = [Qty] * Switch( True(), [Name] = "partial" , 1, [Name] ="whole",4,1)

camargos88
Community Champion
Community Champion

Hi @leroy773 ,

 

Try this column on Power Query:

if Text.Contains([Part Name], "partial") then 1 else 4 * [Qty]

 

Capture.PNG 



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

Proud to be a Super User!



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.