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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

VAR with a CountRows and adding a filter out for another column

Hello, I have the following code and am looking to add a filter to it to remove inputs in another column.  I've filtered for, but never against and never from a different column, so I'm a little out of my element. Any help would be greatly appreciated.

 

Active = VAR __CurrentRowID = Main[Employee ID]
RETURN
COUNTROWS(
FILTER(
ALL(Main),
__CurrentRowID = Main[mgr_emplid]
)
)
 
The column name is: Main[Position].  I have over 400 values in it, but would like to filter out the following values so that the column returns a count of everything else. 
 
Remove:
Team Member
Team Member - Nights
Team Member - Nights - DO
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

As the official document said, ALL() function returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied. This function is useful for clearing filters and creating calculations on all the rows in a table.

 

Please try the following formula to add a column:

Active =
VAR __CurrentRowID = Main[Employee ID]
RETURN
    CALCULATE (
        COUNTROWS ( 'Main' ),
        FILTER (
            'Main',
            'Main'[mgr_emplid] = __CurrentRowID
                && NOT ( [Position]
                IN { "Team Member", "Team Member - Nights", "Team Member - Nights - DO" } )
        )
    )

The final output is shown below:

2.4.4.1.PNG

 

Here is the pbix file.


Best Regards,
Eyelyn Qin
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

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

As the official document said, ALL() function returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied. This function is useful for clearing filters and creating calculations on all the rows in a table.

 

Please try the following formula to add a column:

Active =
VAR __CurrentRowID = Main[Employee ID]
RETURN
    CALCULATE (
        COUNTROWS ( 'Main' ),
        FILTER (
            'Main',
            'Main'[mgr_emplid] = __CurrentRowID
                && NOT ( [Position]
                IN { "Team Member", "Team Member - Nights", "Team Member - Nights - DO" } )
        )
    )

The final output is shown below:

2.4.4.1.PNG

 

Here is the pbix file.


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

amitchandak
Super User
Super User

@Anonymous , not very clear you can use all or removefilters

refer: https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I read your article, and maybe I'm misunderstanding or I wasn't clear.  I'm trying to add a filter to the command to filter out certain values. 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors