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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. 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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors