Forum Discussion
Using a new column, compile a yes or no value for column A based on values in Column B
- Anonymous4 years ago
Try new column
new column =
var _cnt = calculate(distinctCOUNT(Table[Position]), Filter(Table, [Employee names] = earlier([Employee names]) && Table[Position] in {"Casual instructor", "Adjunct Instructor"} ))
return
if( not(isbalnk(_cnt)) && _cnt =2, "Yes", "No") - Anonymous4 years ago
Another Solution:
Hi, Here is an example on how to do this: Positions = var inspect = Inspector[Name] return If ( COUNTROWS ( FILTER ( ALL ( Inspector ), Inspector[Name] = inspect &&( Inspector[Position] = "A" || Inspector[Position] = "B" )))= 2 , "Yes" , "No" ) ...
Hi TheoC,
Thanks for helping. I ran the query you posted but got an error. Please see snip below:
A few observations,
-there's a reference to the table but there's no reference to the columns
- Is this a query for a "measure" or can I use this query in Power Query (ie Calculated column)
I would prefer a "measure" to avoid increasing data size which slows reports but please advise.
Thanks,
Sunny
- Anonymous4 years agoNot applicable
Hi TheoC ,
Thanks for helping. I ran the query you posted but got an error. Please see snip below:
A few observations,
-there's a reference to the table but there's no reference to the columns
- Is this a query for a "measure" or can I use this query in Power Query (ie Calculated column)
I would prefer a "measure" to avoid increasing data size which slows reports but please advise.
Thanks,
Sunny
- TheoC4 years ago
Community Champion
Hi Anonymous
Just in response to the items you noted:
- COUNTROWS is counting the rows on a specific table so it won't use the Column given that the table and the column will always have the same number of rows (hope that makes sense).
- This version is for a Measure. I posted a separate one for a Column.
- You need to use "_1" underscore _ not the "-" regarding the _1. The error is basically saying that it can't identify the "expression" -1. The reason for this is that the VAR has been named _1 and not "-1".
Hope this helps and all the best mate.
Theo 🙂