The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
Hope everyone is well and looking forward to the weekend.
I have an issue, where I have a table/query in PowerBI that contain 67 columns. 6 of those columns return a Yes or No based on whether a criteria in an assessment is met. I need to create a custom column, lets say "Is the place functional?", that returns a "No" value if any of those 6 columns in that row contain a "No" as an answer to their criteria.
Now, in excel I would format the formula as:
=IF(COUNTIF(R16:W16,"No"),"No","Yes")
I am not greatly familiar with PowerQuery or DAX expressions so I was just wondering how I could manage this, I am at a complete loss and would really appreciate any help!!
Solved! Go to Solution.
Another alternative approach for a custom column
You will need to replace [Column4], [Column6], [Column7] with you six column names.
= if List.Contains(Record.ToList([[Column4], [Column6], [Column7]]), "No") then "No" else "Yes"
Another alternative approach for a custom column
You will need to replace [Column4], [Column6], [Column7] with you six column names.
= if List.Contains(Record.ToList([[Column4], [Column6], [Column7]]), "No") then "No" else "Yes"
This worked perfectly, thank you so much!
Hi, @HarryClark
let
// list of "given column" names
given_columns = {"one", "two", "three", "four", "five", "six"},
// replace your_table with a ref to your actual table
result =
Table.AddColumn(
your_table, "Is the place functional?",
(x) =>
if List.Contains(
Record.FieldValues(Record.SelectFields(x, given_columns)),
"No"
) then "No" else "Yes"
)
in
result
Thank you! This looks interesting though more complex than the other solution, I am going to give it a try and see as well though.