cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
NNaj
Helper IV
Helper IV

Counting the number of occurences of a field

Hi Everyone,

 

I would really appreciate anyones help with my situation.

 

Below is a table im working on

 

I am trying to count how many 'trues' and 'falses' there are for each CP_ID. I then want to find the percentage of 'trues' from the total of both 'trues' and 'falses'. 

 

I have tried this but get an error explaining I cant count boolean values.

 

NumberHits = CALCULATE(COUNT(name[WIN_FLAG]), name[WIN_FLAG]=TRUE(),ALL(name[WIN_FLAG]))
 
Any help would be appreciated.

 

 

bi help.png

1 ACCEPTED SOLUTION

Try

 

NumberHits = CALCULATE(COUNT(name[CP_ID]), name[WIN_FLAG]=TRUE())
NumberMisses = CALCULATE(COUNT(name[CP_ID]), name[WIN_FLAG]=FALSE())

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

You can count CP_ID if both do not have any null values (nonoverlapping).

 

 

Good idea, Counting the CP will give me the total of both true and false. How can I then split this and find the number for each true and false?

Try

 

NumberHits = CALCULATE(COUNT(name[CP_ID]), name[WIN_FLAG]=TRUE())
NumberMisses = CALCULATE(COUNT(name[CP_ID]), name[WIN_FLAG]=FALSE())

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors