Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi, I want to count the number of data that does not begins with a certain value.
The valid position code begins with either "0" or "10000" so any code that does not begins with any of those two digits is considered invalid.
Example:
02789220 (valid)
10000568 (valid)
24876490 (invalid)
556 (invalid)
How do I create a measure that counts the number of invalid position code?
This is the measure that I created but it doesnt really gave the correct result. It ended up counting the total data which is wrong.
Sum Invalid Position Code =
CALCULATE(countrows(Filter('zhpla 2022', left('zhpla 2022'[Position Code],1) <> "0" || left('zhpla 2022'[Position Code],5) <> "10000" ))) + 0
Can anyone help me?
Solved! Go to Solution.
Hi @zahidah_mabd ,
According to your description, you should use && but not || in your code, modify it to:
Sum Invalid Position Code =
CALCULATE (
COUNTROWS (
FILTER (
'zhpla 2022',
LEFT ( 'zhpla 2022'[Position Code], 1 ) <> "0"
&& LEFT ( 'zhpla 2022'[Position Code], 5 ) <> "10000"
)
)
) + 0
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @zahidah_mabd ,
According to your description, you should use && but not || in your code, modify it to:
Sum Invalid Position Code =
CALCULATE (
COUNTROWS (
FILTER (
'zhpla 2022',
LEFT ( 'zhpla 2022'[Position Code], 1 ) <> "0"
&& LEFT ( 'zhpla 2022'[Position Code], 5 ) <> "10000"
)
)
) + 0
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
It worked! Thank you sooo much 🙂
Hi @zahidah_mabd ,
First, I woud create a calculated column that determines whether the start of a value is zero or not. That would be
Zero =
LEFT ( Table[Column], 1 ) = "0"
|| LEFT ( Table[Column], 5 ) = "10000"
//this assumes that column is a text type
Then a measure to count the number of rows
Row Count =
CALCULATE ( COUNTROWS ( Table ), FILTER ( Table, Table[Zero] = TRUE () ) )
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 193 | |
| 123 | |
| 99 | |
| 67 | |
| 49 |