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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Creating measure based on 2 statements

Hi, I'm having issues creating a measure that can filter vaules in 2 separate columns. I'm looking to calculate kidnapping rate for each type of alert. My original calculation doesn't seem to take into account the type of alert.

 

I've attached some screenshots of the fields i'm looking to filter. (Type of Alert) and (Incidents with Crew Kidnapped)

 

Would be eternally grateful for any help.

Capture.PNG

Capture1.PNG

1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

[# Alerts] = COUNTROWS( T ) // T being your table

[Kidnapping Rate] =
DIVIDE(
    CALCULATE(
        [# Alerts],
        KEEPFILTERS(
            // Names of columns should be
            // as short as possible but
            // still meaningful.
            T[Incidents with Crew Kidnapped] = "YES"
        )
    ),
    [# Alerts]
)

I warn you against having one-table models and not following the star schema. Watch this: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Why-one-table-models-will-produce-WRONG-NUMBE...

 

View solution in original post

4 REPLIES 4
daxer-almighty
Solution Sage
Solution Sage

[# Alerts] = COUNTROWS( T ) // T being your table

[Kidnapping Rate] =
DIVIDE(
    CALCULATE(
        [# Alerts],
        KEEPFILTERS(
            // Names of columns should be
            // as short as possible but
            // still meaningful.
            T[Incidents with Crew Kidnapped] = "YES"
        )
    ),
    [# Alerts]
)

I warn you against having one-table models and not following the star schema. Watch this: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Why-one-table-models-will-produce-WRONG-NUMBE...

 

Anonymous
Not applicable

Thanks for your solution, it is very much appreciated. I shall take a look at the video to improve things.

daxer-almighty
Solution Sage
Solution Sage

First of all, from what you've shown you simply can't caculate this. You have to be able to link the two tables somehow. Currently, as it stands, this model is useless for the type of caclulation you want do perform.

 

Are these two tables just one table?

Anonymous
Not applicable

Sorry i forgot to metion that this is all part of one table.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.