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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Conditional Statement not having expected behavior

Hi Everyone,

I created a conditional statement for a custom column. I have two sets of columns I'm using to determine the custom column's value.

 

IF (Installation Status = True) & (Version >= 8.2.6) then the custom column called Protected will be True. 

 

However, for all the records where Version is 8.2.11 and such the column Protected is showing as False. My intuition is telling me this issue has something to do with comparing characters? But I'm not exactly sure how to resolve this.

 

Any suggestions or advice would be helpful. Thanks in advance for your expertise and time!Capture.PNG

1 ACCEPTED SOLUTION
Manoj_Nair
Solution Supplier
Solution Supplier

@Anonymous - quick workaround is by changing the data type of version column to Date and you will get a comparable column as shown below and then you use a conditional column.

image.jpg

If this post helps to find solution would be happy if you could mark my post as a solution and give it a thumbs up

 

Best regards

Manoj Nair

Linkedin - https://www.linkedin.com/in/manoj-nair-%E2%98%81-344666104/

View solution in original post

3 REPLIES 3
Manoj_Nair
Solution Supplier
Solution Supplier

@Anonymous - quick workaround is by changing the data type of version column to Date and you will get a comparable column as shown below and then you use a conditional column.

image.jpg

If this post helps to find solution would be happy if you could mark my post as a solution and give it a thumbs up

 

Best regards

Manoj Nair

Linkedin - https://www.linkedin.com/in/manoj-nair-%E2%98%81-344666104/

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Anonymous - your intuition is correct.  When Alphanumeric ordering occurs the 6 is greater that 11 because the 6 is compared to the first character.  I would suggest trying to format the number by adding leading zeros.  For example, convert from  "8.2.11"  to "08.02.11".
Try using:

Text.Split - PowerQuery M | Microsoft Learn

List.Transform - PowerQuery M | Microsoft Learn
Text.PadStart - PowerQuery M | Microsoft Learn
Text.Combine - PowerQuery M | Microsoft Learn

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WstAz0jNTitWBsAwNwUxDYz0QUoqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Added Custom" = Table.AddColumn(Source, "New Column", each 
            Text.Combine(
                List.Transform(
                    Text.Split( [Column1], "." ),
                    each Text.PadStart( _ , 2 , "0" )
                )
            , ".")
            , type text)
in
    #"Added Custom"

 

watkinnc
Super User
Super User

You should be using "and" instead of "&" for your conditional statement.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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