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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
njxfoster
Helper I
Helper I

How to If text column CONTAINS specified value, Then Count it

Hi Everyone,

 

I'm trying to create a calculated measure in one of my tables that help me count every column that contains the word "Warm".

 

How can I implement CALCULATE(COUNTROWS to achieve this function? 

 

 

Thank you

1 ACCEPTED SOLUTION

Hi @njxfoster 

 

Try this measure:

Measure =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', CONTAINSSTRING ( 'Table'[Connection Details], "Warm" ) )
)

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

3 REPLIES 3
ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

CountWarm = COUNTROWS(
FILTER(
ADDCOLUMNS(Temperature,"Test",
if(SEARCH("Warm",Temperature[Temperature],,2)<>2,1,0)),[Test]=1))


End result:
ValtteriN_0-1642623635705.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi ValtteriN! Thank you for your answer

 

The table is for phone transfer detail, There is a column about "Connection Details". I need to see how many phone connection is being " Warm transfered"  So I was thinking to count columns that contain the word "Warm" .

 

is there any way to count this without creating new column?

 

Thanks in advance

Hi @njxfoster 

 

Try this measure:

Measure =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', CONTAINSSTRING ( 'Table'[Connection Details], "Warm" ) )
)

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Kudoed Authors