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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
LaurensM02
Regular Visitor

Countrows in multiple column based on partial text value

Dear all,

 

For a project I need to be able to count the number of rows in a file, based on a text value in one of eight defined columns.

I want to count a row when one of the "Linked Issues" columns contains a text value that starts with "THGRW-".

 

I tried using the COUNTROWS function combined with FILTER for only one column, which looks like this:

Episode without SM =
    COUNTROWS(FILTER('Sheet1', 'Sheet1'[Linked Issues.1] >= "THGRW-000"))
 
For multiple columns I wanted to just sum (using the + operator) the countrows functions, but already this function for a single column does not give me a result.

 

The sheet looks something like this (Sheet1):

KeyLinked Issues.1Linked Issues.2Linked Issues.3Linked Issues.4Linked Issues.5Linked Issues.6Linked Issues.7

ICB-1

THGRW-123IDF-210     
ICB-2IPQ-11THGRW-10STR-22    
ICB-3 THGRW-55     
ICB-4   THGRW-55   
ICB-5     THGRW-191 
5 REPLIES 5
Thejeswar
Super User
Super User

Hi @LaurensM02 ,

Your DAX won't work. That is because 

>= operator will work only with numbers. But you are using >= with a string value

i.e.

COUNTROWS(FILTER('Sheet1''Sheet1'[Linked Issues.1] >= "THGRW-000"))

In the above  DAX, THGRW-000 is a string and hence cannot be used with a >= operator

 

You will have to use a == operator or an IN operator to compare text and count. Then sum the different conditions.

 

If you want more focused answer, pls. share how your output should look.

I also tried the following formula, but this results in a blank result when added to a card visual. I don't know what's wrong.

LaurensM02_0-1697631897469.png

 

Hi Thejeswar,

 

Thanks for your quick response. I am using the measure for a card visual that shows the total number of rows that meet the filter conditions. So the output should eventually be a number.

 

Also I tried using a wildcard character in the text value, since the filter needs to count every row where one of the Linked Issues columns contain a value that starts with "THGRW-", but I could not get that working.

@LaurensM02 ,

You can convert your table to look like below using Unpivot Columns option in Power Query Editor

 

Refer below link

Unpivot Columns in Power BI 

 

Thejeswar_0-1697632711230.png

Post that you can use the below DAX to get the ouput that you were expecting. In this case there are 5 combinations having "THGRW" in them

Thejeswar_1-1697632804382.png

 

I have a strange problem before I want to start unpivotting columns. The following formula gives me the correct number of rows. But whenever I change it to [Linked Issues.2] or another number, the formula returns a blank.

LaurensM02_0-1697634914275.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors