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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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