cancel
Showing results for 
Search instead for 
Did you mean: 
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 Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors