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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Count filtering

Hi all, I have this similar table:

 

Name                              Project

Jose Carlos                          A

David Fernandez                 B

Carlos Andres                      C

Jose Carlos                          D   

Jose Carlos                          E

Andrea Marin                      F

 

I need a card to count the total number of projects per person.

 

For example, if I use a slicer for projects and I choose Project A the card shows me that Jose Carlos has 3 projects.

 

Thanks a lot

6 REPLIES 6
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

You can use the below measure.

 

Count of Projects =
var _cc = COUNT(ProjectDetials[Name])
Var _sel = SELECTEDVALUE(ProjectDetials[Name])

return
if (ISBLANK(_sel),CONCATENATE("Total Project ",_cc),CONCATENATE(CONCATENATE(CONCATENATE(_sel, " has "),_cc)," projects "))
 
 
123.JPG
 
Regards,
Harsh Nathani
 
 
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
In case it does not help, please provide additional information and mark me with @
Anonymous
Not applicable

@harshnathani it actually works when i use a Slicer for Name, but i need it to work with a Project Slicer. Example: in a slicer for project a choose A then the card will show the total projects of the person for the Project A in this case 3 projects.

 

Thanks

Hi @Anonymous ,

 

You can use the below measure:

 

COUNT of Projects =
VAR _cc =
    COUNT ( ProjectDetials[Name] ) 
VAR _sel =
    SELECTEDVALUE ( ProjectDetials[Name] ) 
VAR _sel1 =
    SELECTEDVALUE ( ProjectDetials[Project] ) 
VAR _name =
    VALUES ( ProjectDetials[Name] ) 
VAR _ccx =
    CALCULATE (
        COUNT ( ProjectDetials[Project] ),
        FILTER (
            ALL ( ProjectDetials ),
            ProjectDetials[Name]
             =
                _name
        )
    )
return
    SWITCH (
        TRUE (),
        NOT ( ISBLANK ( _sel1 ) ),
        CONCATENATE (
            CONCATENATE ( CONCATENATE ( _name, " has " ), _ccx ),
            " projects "
        ),
        NOT ( ISBLANK ( _sel ) ),
        CONCATENATE (
            CONCATENATE ( CONCATENATE ( _sel, " has " ), _cc ),
            " projects "
        ),
        ISBLANK ( _sel ),
        CONCATENATE ( "Total Project ", _cc ),
        ISBLANK ( _sel1 ),
        CONCATENATE ( "Total Project ", _cc ),
        BLANK ()
    )

 

123.JPG

 

Regards,

Harsh Nathani

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Anonymous
Not applicable

@harshnathani Hi, I tried it but still the filter for name has to be marked. Also I need it to just show the value 3 and not Jose Carlos has 3 projects. 

 

 
 
COUNT of Projects =
VAR _cc =
COUNT ( Lider[Líder] )
VAR _sel =
SELECTEDVALUE ( Lider[Líder])
VAR _sel1 =
SELECTEDVALUE ( Lider[Proyecto] )
VAR _name =
VALUES ( Lider[Líder] )
VAR _ccx =
CALCULATE (
COUNT ( Lider[Proyecto] );
FILTER (
ALL ( Lider );
Lider[Líder]
=
_name
)
)
return
SWITCH (
TRUE ();
NOT ( ISBLANK ( _sel1 ) );
CONCATENATE (
CONCATENATE ( CONCATENATE ( _name; " has " ); _ccx );
" projects "
);
NOT ( ISBLANK ( _sel ) );
CONCATENATE (
CONCATENATE ( CONCATENATE ( _sel; " has " ); _cc );
" projects "
);
ISBLANK ( _sel );
CONCATENATE ( "Total Project "; _cc );
ISBLANK ( _sel1 );
CONCATENATE ( "Total Project "; _cc );
BLANK ()
)

Thanks a lot. 

@Anonymous ,

 

Not sure how the filter of name can be marked when you are selecting the projects. These are 2 independant objects.

 

Anyways, here is the code for showing the no. of projects i.e value 3.

 

Count of Projects =
var _cc = COUNT(ProjectDetials[Name])
Var _sel = SELECTEDVALUE(ProjectDetials[Name])
var _sel1 = SELECTEDVALUE(ProjectDetials[Project])
var _name = VALUES(ProjectDetials[Name])
var _ccx = CALCULATE(COUNT(ProjectDetials[Project]),FILTER(ALL(ProjectDetials),ProjectDetials[Name] = _name))
return
SWITCH(
true(),
NOT(ISBLANK(_sel1)),_ccx,
NOT(ISBLANK(_sel)),_cc,
ISBLANK(_sel),_cc,
ISBLANK(_sel1),_cc,
BLANK()
)
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!

Hello:

If I understood correctly, you need something like this

foto filtrada.PNGTargeted Photos

foto sin filtrar.PNGUntargeted Photo

The idea is that per user will show you the total of projects assigned to it, and by segmenting it shows only the user or users assigned to the project with all the pro-tests assigned

Is that all right? The formula is in the picture.

I'm reviewed.

Best regards

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors