Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I'm trying to create a custom column that returns 1 or 0 depending on if specific values of two columns are met.
My current code below is only returning 0 (FALSE):
= if [Status]= "Responded" and [WithinSLA] = "TRUE" then 1 else 0
I'd like to return 1 (TRUE) if there's "Responded" in the Status column and if "TRUE" is in the WithinSLA column.
Thanks for any help.
Solved! Go to Solution.
Hello,
Best practice is to add the new column inside power query (copy paste this code inside a new blank query/ advanced editor):
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkotLsjPS0lNUdJRCgkKdVWK1YlWCkjNS8nMSwcKuTn6BEPEkBVCRWMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Status = _t, WithinSLA = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Status", type text}, {"WithinSLA", type logical}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [Status] = "Responded" and [WithinSLA] = true then 1 else 0, type number)
in
#"Added Custom"
but if you prefer a DAX calculated column, this should do the work:
Custom2 =
IF(MyTable[Status] = "Responded" && MyTable[WithinSLA] = TRUE(), 1, 0)
If it answers your query, please mark my pos as the solution. Thanks!
Best regards,
Alex
Hello,
Best practice is to add the new column inside power query (copy paste this code inside a new blank query/ advanced editor):
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkotLsjPS0lNUdJRCgkKdVWK1YlWCkjNS8nMSwcKuTn6BEPEkBVCRWMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Status = _t, WithinSLA = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Status", type text}, {"WithinSLA", type logical}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [Status] = "Responded" and [WithinSLA] = true then 1 else 0, type number)
in
#"Added Custom"
but if you prefer a DAX calculated column, this should do the work:
Custom2 =
IF(MyTable[Status] = "Responded" && MyTable[WithinSLA] = TRUE(), 1, 0)
If it answers your query, please mark my pos as the solution. Thanks!
Best regards,
Alex
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |