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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MulberyPie
Advocate I
Advocate I

How COUNT a value unaffected by filters

I want to count the # of times a text value is in a column, but when I filter those text values, that total count does not change. I have mutliple related columns and when I filter down the line it decreases the count of some of the first items.

1 ACCEPTED SOLUTION

Hi @MulberyPie ,

I updated your sample pbix file(see the attachment), please check whether that is what you want. Please update the formula of measure [unfiltered_count] as below:

unfiltered_count = 
VAR _species =
    CALCULATETABLE (
        VALUES ( 'plant_table'[Species] ),
        FILTER (
            'plant_table',
            'plant_table'[Type] IN ALLSELECTED ( 'plant_table'[Type] )
        )
    )
RETURN
    CALCULATE (
        COUNT ( plant_table[Species] ),
        FILTER ( ALL ( 'plant_table' ), 'plant_table'[Species] IN _species )
    )

yingyinr_0-1654226138478.png

Best Regards

Community Support Team _ Rena
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

5 REPLIES 5
amitchandak
Super User
Super User

@MulberyPie ,

 

calculate(Count(Table[Column]), all(Table) )

 

or

 

calculate(Count(Table[Column]), all() )

 

 

The current equation returns the total entries in the column rather than the # of times each values is repeated. I have three values, 'text1', 'text2', 'text3' and they all return the same total number. How could I each values # of occurences?

Hi @MulberyPie ,

I'm not clear about your requirement, could you please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

So this is the data normally

MulberyPie_0-1654179927298.png

 

 

When I filter I want the count column to have the same numbers as if it were unfiltered, but the rows shown be filtered. This is the output I want.

MulberyPie_1-1654180023745.png

This is the output I normally get

MulberyPie_2-1654180055804.png

This is the file

 

Hi @MulberyPie ,

I updated your sample pbix file(see the attachment), please check whether that is what you want. Please update the formula of measure [unfiltered_count] as below:

unfiltered_count = 
VAR _species =
    CALCULATETABLE (
        VALUES ( 'plant_table'[Species] ),
        FILTER (
            'plant_table',
            'plant_table'[Type] IN ALLSELECTED ( 'plant_table'[Type] )
        )
    )
RETURN
    CALCULATE (
        COUNT ( plant_table[Species] ),
        FILTER ( ALL ( 'plant_table' ), 'plant_table'[Species] IN _species )
    )

yingyinr_0-1654226138478.png

Best Regards

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

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors