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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Conditional Column using "if" and "or"

Hi Community,

i want to create a contidional column based on differente conditions. those conditions must not have to be mandatory at the same time.

so i want to do this:

 

= Table.AddColumn(#"Changed Type2", "Custom", each if [Name] = "n/a" and/or [CreatedBy] = "n/a" then "no" else "Yes")

 

but i am not able to do this type of conditioonal using "or"

 

Any help

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Maybe you can provide some sample data to help clarify your desired output better? For example, in below image, if this is not what you want, then what should be the result you want to have in the new column?

21090805.jpg

 

Regards,
Community Support Team _ Jing

Greg_Deckler
Community Champion
Community Champion

@Anonymous Should be:

 Table.AddColumn(#"Changed Type2", "Custom", each if [Name] = "n/a" or [CreatedBy] = "n/a" then "no" else "Yes")

For example, this works for me:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyVnDOzy1IzKtUMDLVMzDTMzJUitWJVoqIjMIu4eLkiJAwg0nEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Column1.1", "Column1.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type1", "Column1.2", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Column1.2.1", "Column1.2.2", "Column1.2.3"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Column1.2.1", Int64.Type}, {"Column1.2.2", Int64.Type}, {"Column1.2.3", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type2", "Custom", each #date(2000+[Column1.2.3],[Column1.2.2],[Column1.2.1])),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1.2.1", "Column1.2.2", "Column1.2.3"}),
    #"Added Custom1" = Table.AddColumn(#"Removed Columns", "Custom.1", each if [Column1.1] = "ABC Company" or [Column1.1] = "DBA Company" then "no" else "Yes")
in
    #"Added Custom1"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Thanks for the replay,#using only "or" does not work as a conditional

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors