jake
jake

Reputation: 5

How to create a measure in power bi that counts yes and no values based on a country

I am new to power bi, i am trying to use "state cards" by okviz to create multiple dynamic cards.

i have an example of the following data structure: table 1

Country  | Answer
Amercica | Yes
America  | NO
America  | YES
America  | Yes
Brazil   | NO
Brazil   | NO
Brazil   | NO
Brazil   | NO
Brazil   | yes

how do i create a measure in power bi that counts the yes and no columns per country and gives me the following output

Country | Answer |count
America |Yes     |3
America |No      |1
Brazil  |Yes     |1
Brazil  |No      |4

Upvotes: 0

Views: 4426

Answers (1)

Agustin Palacios
Agustin Palacios

Reputation: 1204

First standardize the Answer column. This is not necessary but I don't like all those different yes words.

enter image description here

You don't need a measure to achieve this. You can drag a column and chose the count option. But if you really need a measure use the following expression:

Answer Count = COUNT( 'Table'[Answer] )

enter image description here

Both ways you obtain the same result.

Upvotes: 1

Related Questions