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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jammo1234
New Member

CountX with string does not contain "."

Hi all,

 

Bit of a newbie question here, Im trying to filter rows in the table where a row does not have a "." suffix on the end.

For example the table name "Table 1" with the Column name called "ElementID". Data type for ElementId is a string.

 

If we consider a dataset below:

 

ElementID

dddd.1111

gggg.3535

ggg

hhrt.agb

hhh

hogif.1345

 

I want a function that just returns the rows that do not have a  ".suffix", in this instance "ggg" and "hhh". I'd like to count these rows and put it in a card visualisation.

 

I've managed to get all the count of all the rows as below:

 

count = COUNT('Table 1'[ElementID])

 

I've done some research on the containsstring function and CountX function, but i'm struggling to put them all in one function. Please see my attempt below. I know the containsstring function returns a bool but thats the extent of my knowledge.

 

count = COUNTX(FILTER(NOT(CONTAINSSTRING('Table 1' [ElementID], ".")

 

Any suggestions would be greatly appreciated.

 

Thanks in advance

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@jammo1234 Try:

 

Measure = COUNTROWS(FILTER('Table 1', NOT(CONTAINSSTRING([ElementID], "."))))

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

jammo1234
New Member

Thank you much appreciated 

View solution in original post

2 REPLIES 2
jammo1234
New Member

Thank you much appreciated 

Greg_Deckler
Super User
Super User

@jammo1234 Try:

 

Measure = COUNTROWS(FILTER('Table 1', NOT(CONTAINSSTRING([ElementID], "."))))

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.