Forum Discussion
vanessafvg
Community Champion
8 years agocalculated column = count values? (sum if)
i need to created a calcualted column that counts the columns where the value is yes ie column1 column2 column3 column4 calculatedcolumn yes yes ...
- 8 years ago
Hi vanessafvg,
The solution provided by AndrejZitnay is on the Query editor however if you want to do it in DAX you should use the following formula:
Count of Yes = IF(Table2[1] = "yes";1;0) + IF(Table2[2] = "yes";1;0) + IF(Table2[3] = "yes";1;0) + IF(Table2[4] = "yes";1;0)
Some principal different syntax.
Regards,
MFelix
AndrejZitnay
Post Patron
8 years agoHello vanessafvg
I would maybe to some measurment but if you want that in colum than :
step 1
add 4 conditional columns and if operator equal yes than 1 otherwise 0
step 2
add all 4 conditional columns together.
MFelix
Super User
8 years agoHi vanessafvg and AndrejZitnay,
Although the option from AndrejZitnay is correct you can make it just with one column:
(if [1] = "Yes" then 1 else 0) + (if [2] = "Yes" then 1 else 0) + (if [3] = "Yes" then 1 else 0) + (if [4] = "Yes" then 1 else 0)
Regards,
MFelix