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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Marinus
Frequent Visitor

Countrows without selection

I have a command to countrows with a specific tekst :

CALCULATE(
COUNTROWS('Overzicht aanvragen'),
'Overzicht aanvragen'[Aanvraag_Routelint] IN { "Zvg -", "Vlgr -", "Rsdg -", "Odzg -", "Edng -", "Bdlg -", "Svgg -" }
)

 

Can someone tell me how i can countrows without this specific tekst.

I can't find any DAX code that explains how to do this (i coultn't find the "IN" code too).

1 ACCEPTED SOLUTION

Hi @Marinus,

Thanks for your update.

 

I’ve reproduced your scenario using sample data matching your raw data structure and achieved the expected output. Create the fallowing dax measure to calculate countrows.

 

rows = CALCULATE(
COUNTROWS(
FILTER(ALL('table'),
NOT('table'[Aanvraag_Routelint] IN { "Zvg -", "Vlgr -", "Rsdg -", "Odzg -", "Edng -", "Bdlg -", "Svgg -" })
)
)
)

The .pbix file attached demonstrates this working solution with your sample data.

 

If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

View solution in original post

7 REPLIES 7
v-ssriganesh
Community Support
Community Support

Hello @Marinus,
Thank you for reaching out to the Microsoft Fabric Forum Community.

 

Please try the following DAX measure. I assume that your column contains additional text after the "-" character.

CALCULATE(
    COUNTROWS('Overzicht aanvragen'),
    FILTER(
        'Overzicht aanvragen',
        NOT (
            LEFT('Overzicht aanvragen'[Aanvraag_Routelint], SEARCH(" -", 'Overzicht aanvragen'[Aanvraag_Routelint] & " -") - 1) 
            IN { "Zvg", "Vlgr", "Rsdg", "Odzg", "Edng", "Bdlg", "Svgg" }
        )
    )
)

 

If the issue persists, kindly share a sample dataset along with the expected output. This will help in better understanding the problem and finding an appropriate solution.

 

If you find this information helpful, please consider "Accepting it as a solution" and giving it a "kudos" to assist other community members facing similar challenges.

 

Thank you.

I have deleted the dashes to make it clearer.

I have a command to countrows with a specific tekst :

CALCULATE(
COUNTROWS('Overzicht aanvragen'),
'Overzicht aanvragen'[Aanvraag_Routelint] IN { "Zvg", "Vlgr", "Rsdg", "Odzg", "Edng", "Bdlg", "Svgg" }
)

This way i count only the rows with these texts in it, but now i want to count the rows without these specific texts in it.

Hi @Marinus,

Thanks for your update.

 

I’ve reproduced your scenario using sample data matching your raw data structure and achieved the expected output. Create the fallowing dax measure to calculate countrows.

 

rows = CALCULATE(
COUNTROWS(
FILTER(ALL('table'),
NOT('table'[Aanvraag_Routelint] IN { "Zvg -", "Vlgr -", "Rsdg -", "Odzg -", "Edng -", "Bdlg -", "Svgg -" })
)
)
)

The .pbix file attached demonstrates this working solution with your sample data.

 

If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

bhanu_gautam
Super User
Super User

@Marinus Have you tried NOT and IN

dax
CALCULATE(
COUNTROWS(
FILTER(
'Overzicht aanvragen',
NOT('Overzicht aanvragen'[Aanvraag_Routelint] IN { "Zvg -", "Vlgr -", "Rsdg -", "Odzg -", "Edng -", "Bdlg -", "Svgg -" })
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






This gives still a total of rows in the column, it includes the rows with the selected text.

It should count the rows without the rows with the selected text.

Marinus
Frequent Visitor

The result is a total of the column, but not the amount of rows without these specific text

bhanu_gautam
Super User
Super User

@Marinus , Try using

DAX
CALCULATE(
COUNTROWS('Overzicht aanvragen'),
EXCEPT(
ALL('Overzicht aanvragen'),
FILTER(
'Overzicht aanvragen',
'Overzicht aanvragen'[Aanvraag_Routelint] IN { "Zvg -", "Vlgr -", "Rsdg -", "Odzg -", "Edng -", "Bdlg -", "Svgg -" }
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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