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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Count combinations

Hi everybody,

I hope someone can help me to calculate the number of combinations with Power BI.

I have a data set with a personal number in column A. This number is therefore more common in the table. Column B shows the type of facility this person has. However, one person can have several (different) facilities. The personal number can therefore appear several times in column A. Now I would like to create a table / graph showing the combinations of facilities. So for example: there are 10 people who have both provision x and y. There are 3 persons who have provision x, as y and z. Etc. etc.

I hope I have expressed my question so clearly. If not, let me know.

Thank you in advance.

Greet Joost

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

b1.png

 

You may create a calculated column and a measure as below.

calculated column:
Combinations = 
CONCATENATEX(
    FILTER(
        'Table',
        'Table'[ColumnA] = EARLIER('Table'[ColumnA])
    ),
    'Table'[ColumnB]
)

Measure:
Count Combinations = 
var x = SELECTEDVALUE('Table'[Combinations])
return
CALCULATE(
    DISTINCTCOUNT('Table'[ColumnA]),
    FILTER(
        ALLSELECTED('Table'),
        CONTAINSSTRINGEXACT('Table'[Combinations],x)
    )
)

 

Result:

b3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

b1.png

 

You may create a calculated column and a measure as below.

calculated column:
Combinations = 
CONCATENATEX(
    FILTER(
        'Table',
        'Table'[ColumnA] = EARLIER('Table'[ColumnA])
    ),
    'Table'[ColumnB]
)

Measure:
Count Combinations = 
var x = SELECTEDVALUE('Table'[Combinations])
return
CALCULATE(
    DISTINCTCOUNT('Table'[ColumnA]),
    FILTER(
        ALLSELECTED('Table'),
        CONTAINSSTRINGEXACT('Table'[Combinations],x)
    )
)

 

Result:

b3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

Thxs so much! This is where i was looking for!

Greg_Deckler
Community Champion
Community Champion

I have an example of combinations and permutations in my new DAX Cookbook. If you can post some sample data I can see if it can be applied in your situation. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thxs for you answer! But the sollution of v-alq-msft already did the trick.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors