This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello,
I am getting wrong results using if statement evaluating Text.StartWith function can any one guide me on what I am doing wrong?
IF my CategoryValue results starts with "PC" result should be "Yes", but I am getting "No" instead. Inputs?
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Master Data Number", Int64.Type}, {"Description", type text}, {"UniqueValue", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "CategoryValue", each [
currentLookUp = [UniqueValue] ,
a=
Table.Group(lookup, "UniqueValueCol", {"Grouped", each _}){[UniqueValueCol=currentLookUp]}?[Grouped]?{0}?,
b= if a = null then "No Category Value" else a[CategoryValue]][b]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "TextStart", each if Text.StartsWith([CategoryValue],"PC") = "TRUE" then "Yes" else "No")
in
#"Added Custom1"=1&web=1&e=9yLNqx
Sharing my file here
Solved! Go to Solution.
You've done pretty much everything right, just update this line of code on query "Table1" as follows:
#"Added Custom1" = Table.AddColumn(#"Added Custom", "TextStart", each if Text.StartsWith([CategoryValue],"PC") = true then "Yes" else "No")
@Anonymous no problem! Btw, I was just curious, is there a reason why you preferred not to use the "Merge" functionality to bring data from one table to another? Your approach definitely works but it seems more work to set up and maintain. Cheers.
Hi @Anonymous , Yes, I agree. 🙂 For my solution I considered merge however but this solution hits works on requirement.
Thanks,
wbw
You've done pretty much everything right, just update this line of code on query "Table1" as follows:
#"Added Custom1" = Table.AddColumn(#"Added Custom", "TextStart", each if Text.StartsWith([CategoryValue],"PC") = true then "Yes" else "No")
Thanks @Anonymous 😁
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.