Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ARoma
New Member

Measure: Count of X, if Y=true

Hi , I'm looking for a Measure in PBI that will allow me to get the Count of Injury, if Forseeble is True, from below table.

Incident numberForseebleInjuryCount of Injury if Forseeble True
1TRUETRUE 
2FALSEFALSE 
3FALSEFALSE 
4FALSETRUE 
5TRUEFALSE 
6TRUETRUE 
7FALSETRUE 
8FALSEFALSE 
9FALSEFALSE 
2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

Hi @ARoma 

try to create a measure with this:

ForeseeableInjuryCount =
CALCULATE(
    COUNTROWS(TableName),
    TableName[Forseeable]=TRUE,
    TableName[Injury]=TRUE
)
 
i tried and it worked like this:
FreemanZ_0-1670310230795.png

 

View solution in original post

Hi @FreemanZ , this is perfect!

Thanks a lot !

 

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

Hi @ARoma 

try to create a measure with this:

ForeseeableInjuryCount =
CALCULATE(
    COUNTROWS(TableName),
    TableName[Forseeable]=TRUE,
    TableName[Injury]=TRUE
)
 
i tried and it worked like this:
FreemanZ_0-1670310230795.png

 

Hi @FreemanZ , this is perfect!

Thanks a lot !

 

ARoma
New Member

Hi @djurecicK2

thanks for looking into this. I'm looking for the Count of Injury True, (not incidents), where Forseeble is also True.

 

Hi @ARoma ,

 Have you tried that measure? If so, what were the results?

Hi @djurecicK2

thanks for looking into this. I'm looking for the Count of Injury True, (not all incidents), where Forseeble is also True. If I undersend corectly , the measure you mentioned above is caluculationg all incidents where Forseable is True. 

djurecicK2
Super User
Super User

Hi @ARoma

 You can try something like this

Count of Foreseeable= CALCULATE(COUNT(Tablename[incident number]),FILTER(tablename, tablename[ForeseeableInjury]= true()))

Use "true" if that field is text. Please adapt to your field and table names.

 

Please accept as solution if this answers the question- thanks!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.