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

I want to count the rows with a specific combination.

Can you tell me wat is wrong in my code?

 

CALCULATE(

    COUNTROWS('Overzicht aanvragen'); Overzicht aanvragen[Aanvraag_Routelint] = "Zvg -,Vlgr -,Rsdg -,Odzg -,Edng -,Bdlg -,Svgg -")

1 ACCEPTED SOLUTION
Cookistador
Super User
Super User

Hello @Marinus 

 

I guess you need to count rows where Aanvraag_Routelint is Zvg -OR Vlgr -OR Rsdg - OR Odzg -OR Edng - OR Bdlg - OR Svgg -"

If I'm right, you have to use IN feature, so you code should become

 

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

 

View solution in original post

7 REPLIES 7
techies
Super User
Super User

Hi @Marinus do you want to match entire string ? or partial match?

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978
praveen_511
Frequent Visitor

@Marinus Your DAX formula has a syntax error, as semicolons (;) are being used instead of commas (,), which are the correct parameter separators for functions in DAX. Additionally, the specific combination condition for Overzicht aanvragen[Aanvraag_Routelint] isn't properly defined for a multi-condition comparison.

The corrected DAX :
CALCULATE(
COUNTROWS('Overzicht aanvragen'),
'Overzicht aanvragen'[Aanvraag_Routelint] = "Zvg -, Vlgr -, Rsdg -, Odzg -, Edng -, Bdlg -, Svgg -"
)

bhanu_gautam
Super User
Super User

@Marinus The CALCULATE function in DAX is used to modify the context in which data is evaluated, but the syntax you are using for the filter condition is not correct. You should use the FILTER function to specify the condition within CALCULATE

 

CALCULATE(
COUNTROWS('Overzicht aanvragen'),
FILTER('Overzicht aanvragen', 'Overzicht aanvragen'[Aanvraag_Routelint] = "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






vivek31
Resolver II
Resolver II

HI @Marinus ,

you can use this formula -
CALCULATE(COUNTROWS('Overzicht aanvragen'),
'Overzicht aanvragen'[Aanvraag_Routelint]

IN {"Zvg -", "Vlgr -", "Rsdg -", "Odzg -", "Edng -", "Bdlg -", "Svgg -"}
)

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

Pow3Range
Frequent Visitor

Hi @Marinus 
Could you please let me know what error you encountered?

Cookistador
Super User
Super User

Hello @Marinus 

 

I guess you need to count rows where Aanvraag_Routelint is Zvg -OR Vlgr -OR Rsdg - OR Odzg -OR Edng - OR Bdlg - OR Svgg -"

If I'm right, you have to use IN feature, so you code should become

 

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

 

I hope you can help me with my next question.

I have this code :

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.

I hope you can help me.

 

With regards

Marinus Schouten

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.