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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to count rows where length of field is not 11?

Hi all

I am trying to count rows of a table (Vendors) where field (Vendor ID) length is NOT 11. I have tried the below but am getting an error:

 

 

AVendIDNoComp =
VAR a =
    CALCULATE (
        COUNTROWS ( Vendor ),
        FILTER ( Vendor, LEN ( Vendor[Vendor ID] <> 11 ) )
    )
RETURN
    a

 

The error I am getting is:

 

DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values

 

The Vendor ID is a text field, and contains alphanumeric characters. Any advice on how I can go about resolving this issue?

Example data contained in the field would be:

 

V01234/US

V83627/UK36

V93756/ES

 

So with the above example data I would return a count of 2 using this measure. Just to add, this is a live connection to a PBI dataset, and I have no access to amend the data model/edit query.

Many thanks for all help

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

You just have a typo - no closing parenthesis after LEN ( Vendor[Vendor ID]...

Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

I am having a bad day!

Jos_Woolley
Solution Sage
Solution Sage

Hi,

You just have a typo - no closing parenthesis after LEN ( Vendor[Vendor ID]...

Regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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