cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
GuidoPinares
Helper I
Helper I

Mesure to count repetitions

Hi Community!

 

I have been practicing and feel stucked in this part, if someone could give me some guide i will be grateful.

 

I have the next example table:

 

GuidoPinares_0-1658263029928.png

 

I would like to transfer this logic to Power BI. I have a column name, an activity and a group. I want to know if a Person has "any group" and also the group "Others", for example if the person is on Wheels and Balls group it counts as False, is True just when is in any group and also in Others.

 

My mind is blowing, i will appreciate any help!

 

Thanks in advance.

1 ACCEPTED SOLUTION

Thanks for the help!!

At the beggining it doesnt work because i think it was taking the last record boolean, so i add this line and it works.

ALLEXCEPT('Table','Table'[Name])
 
So the code finally is this way:

Control =
VAR other = CALCULATE(COUNTROWS('Table');
                'Table'[Name] = EARLIER('Table'[Name]) &&
                'Table'[Group] = "Others", ALLEXCEPT('Table','Table'[Name])) > 0
VAR some_group = CALCULATE(COUNTROWS('Table');
                'Table'[Name] = EARLIER('Table'[Name]) &&
                'Table'[Group] <> "Others", ALLEXCEPT('Table','Table'[Name])) > 0
RETURN
AND(other;some_group)
 

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Count of activites and group = CALCULATE(COUNTROWS(Data),ALLEXCEPT(Data,Data[name]))
Count of Other group = CALCULATE(COUNTROWS(Data),ALL(Data[Activity]),Data[Group]="Others")
Control = if(max(Data[Group])="Others","-",[Count of activites and group]<>1)

Hope this helps.

Untitled.png


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

Hi ! 

 

I think you can do this as a new column

 

Control =
VAR other = CALCULATE(COUNTROWS('Table');
                'Table'[Name] = EARLIER('Table'[Name]) &&
                'Table'[Group] = "Others") > 0
VAR some_group = CALCULATE(COUNTROWS('Table');
                'Table'[Name] = EARLIER('Table'[Name]) &&
                'Table'[Group] <> "Others") > 0
RETURN
AND(other;some_group)
 
Cheers
PAG

Thanks for the help!!

At the beggining it doesnt work because i think it was taking the last record boolean, so i add this line and it works.

ALLEXCEPT('Table','Table'[Name])
 
So the code finally is this way:

Control =
VAR other = CALCULATE(COUNTROWS('Table');
                'Table'[Name] = EARLIER('Table'[Name]) &&
                'Table'[Group] = "Others", ALLEXCEPT('Table','Table'[Name])) > 0
VAR some_group = CALCULATE(COUNTROWS('Table');
                'Table'[Name] = EARLIER('Table'[Name]) &&
                'Table'[Group] <> "Others", ALLEXCEPT('Table','Table'[Name])) > 0
RETURN
AND(other;some_group)
 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors