cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
NNaj Regular Visitor
Regular Visitor

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

Accepted Solutions
amitchandak Super Contributor
Super Contributor

Re: Counting the number of occurences of a field

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 Contributor
Super Contributor

Re: Counting the number of occurences of a field

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

 

 

NNaj Regular Visitor
Regular Visitor

Re: Counting the number of occurences of a field

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?

amitchandak Super Contributor
Super Contributor

Re: Counting the number of occurences of a field

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

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 387 members 3,424 guests
Please welcome our newest community members: