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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Dax code for identifying if an ID is part of multiple groups

Hi,

I have a dataset as shown below:

IDGroup
100A
100B
200C
300D
400E
400F
500G
500A
500B
600C
600D
600E
600F
600G


From this dataset I want to get the number of IDs which are part of only one group and number of IDs that are part of 2 groups and so on. In this case, IDs 200 and 300 are part of only single groups while 100 and 400 are part of 2 groups. 
Similarly 500 and 600 are part of more than 2 groups.

So could someone help me with measure calculations that gives me the result as:
Number of IDs that are part of a single group           : 2
Number of IDs that are part of 2 groups                    : 2
Number of IDs that are part of more than 2 groups  : 2

Thanks a lot for your support here.



 

1 ACCEPTED SOLUTION
SamInogic
Super User
Super User

Hi @Anonymous ,

You can follow below steps,

 

Create a new custom column to count the ID that are part of a group,

 

CountData = CALCULATE(

    COUNT(Grps[Group]), // counting the Type

    FILTER(

        Grps, // filtering the table to get the count of type groupoed by Make

        Grps[ID] = EARLIER(Grps[ID])

    )

)

Then Create 3 Measure in order to get Single Group, Two Group, Multiple Group ID counts with below DAX expressions,

 

Single Grp = CALCULATE( COUNT(Grps[Group]), Grps[CountData] =1)

Two Grps = CALCULATE( COUNT(Grps[Group]), Grps[CountData] =2)

Multiple Grps = CALCULATE( COUNT(Grps[Group]), Grps[CountData] >2)

 

The result will be as follows,

SamInogic_0-1695968662196.png

Thanks!

 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

It works.
Thanks a lot for your help here.

SamInogic
Super User
Super User

Hi @Anonymous ,

You can follow below steps,

 

Create a new custom column to count the ID that are part of a group,

 

CountData = CALCULATE(

    COUNT(Grps[Group]), // counting the Type

    FILTER(

        Grps, // filtering the table to get the count of type groupoed by Make

        Grps[ID] = EARLIER(Grps[ID])

    )

)

Then Create 3 Measure in order to get Single Group, Two Group, Multiple Group ID counts with below DAX expressions,

 

Single Grp = CALCULATE( COUNT(Grps[Group]), Grps[CountData] =1)

Two Grps = CALCULATE( COUNT(Grps[Group]), Grps[CountData] =2)

Multiple Grps = CALCULATE( COUNT(Grps[Group]), Grps[CountData] >2)

 

The result will be as follows,

SamInogic_0-1695968662196.png

Thanks!

 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.