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