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
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
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.