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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
remaster
Frequent Visitor

Count when a group of columns of the same table have certain value

Hello guys, I'm really confused because I want to do this...

I have a table with this style

image.png

What I need is to Count how many times in a row the words "OutSite(MTY)" or "Rest Day" repeats.

Im looking to achieve this with the following formula

Absences = CALCULATE(
COUNTROWS('dbpenrh emergencypaymentroll'),
SEARCH("OutSite(MTY)",'dbpenrh emergencypaymentroll',1,0))

The problem is that the SEARCH function doesn't "search" in all the table but needs at least 1 column...

Absences = CALCULATE(
COUNTROWS('dbpenrh emergencypaymentroll'),
SEARCH("OutSite(MTY)",'dbpenrh emergencypaymentroll'[Day_1],1,0))

Thats different from what I need.

I need something like a range for the SEARCH that goes from Day_1 to Day_30... 

 

How can I do this? Is really giving me a bad time ....

Any help is so much appreciated

 

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, select all columns other than the Day columns > Right click > Unpivot other columns.  Drag Value column to the row labels.  Write this measure

=COUNTROWS(Data)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, select all columns other than the Day columns > Right click > Unpivot other columns.  Drag Value column to the row labels.  Write this measure

=COUNTROWS(Data)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

it's a different situation, what I'm trying to do is

count 

emergencypaymentroll [Day_1],emergencypaymentroll [Day_2],emergencypaymentroll [Day_3] ..... emergencypaymentroll [Day_30]

when = "OutSite(MTY)"

To get something like this, I think that I need One Measure per Search, but the first thing I need to solve is the search trought all the columns in the table.

OutSite(MTY) ||   3
Rest Day        ||   2
Abscence       ||   1

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors