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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Card to show an equivalent of excel countif

I have a card that i want to show the number of projects that where ProjectStatus = Active, and StatusRAG = Red.
I was using a filter on the card and that worked until I have started using bookmarks. When resetting the filters in the service, the filter on the cards are removed resulting in an incorrect value being shown.
I assume there is a more robust method for setting these values, can anybody suggest what is best?

 

PS, The card is using the following formula so that it will show 0 insted of (Blank)


zzMeasureProjectStatusActiveIF =
IF (
COUNTAX('Projects (2)', 'Projects (2)'[ProjectStatus] = "Active") = BLANK (),
"0",
COUNTAX('Projects (2)', 'Projects (2)'[ProjectStatus] = "Active")
)

1 ACCEPTED SOLUTION
vivran22
Community Champion
Community Champion

@Anonymous 

 

You may also use:

 

CountA Filter =
COUNTAX (
    'Projects (2),
    IF (
        'Projects (2)'[ProjectStatus] = "Active"
            && 'Projects (2)'[StatusRAG ] = "Red",
        'Projects (2)'[ProjectStatus]
    )
)

Rgds,

Vivek

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

Have you solved your problem?

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please share your data sample and your desired output so that we could help further on it.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
vivran22
Community Champion
Community Champion

Hi,

Has this been resolved?

Rgds,
Vivek
vivran22
Community Champion
Community Champion

@Anonymous 

 

You may also use:

 

CountA Filter =
COUNTAX (
    'Projects (2),
    IF (
        'Projects (2)'[ProjectStatus] = "Active"
            && 'Projects (2)'[StatusRAG ] = "Red",
        'Projects (2)'[ProjectStatus]
    )
)

Rgds,

Vivek

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

MattAllington
Community Champion
Community Champion

The better approach is to use calculate. 

 

Something like this (substitute your columns)

 

=CALCULATE(countrows(projects),projects[status]=“Active”,Projects[rag]=“Red”)



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors