cancel
Showing results for 
Search instead for 
Did you mean: 
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

 

View solution in original post

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)

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.