Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all!
I have the following table as a data source in Power BI:
What I want to do is to see how many unique combinations of categories are there within all groups and sum them up by category. For example, category 3 has 4 total combinations across all groups (0 in group 1 + 2 in group 2 (with categories 1 and 2) + 2 in group 3 (with categories 1 and 2) = 4 combinations in total).
In the end, I want a table that looks like this:
Have been testing various DAX functions in order to achieve that result, but no luck.
Would greatly appreciate your help!
Solved! Go to Solution.
Hi, @dmitry-wbr
Please try the below measure.
Count measure =
VAR currentcategory =
MAX ( 'Table'[Category] )
VAR includingcurrentcategory =
VALUES ( 'Table'[Group] )
VAR newtable =
SUMMARIZE (
FILTER (
ALL ( 'Table' ),
'Table'[Group]
IN includingcurrentcategory
&& 'Table'[Category] <> currentcategory
),
'Table'[Group],
'Table'[Category]
)
RETURN
SUMX ( newtable, 1 )
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
Hi, @dmitry-wbr
Please try the below measure.
Count measure =
VAR currentcategory =
MAX ( 'Table'[Category] )
VAR includingcurrentcategory =
VALUES ( 'Table'[Group] )
VAR newtable =
SUMMARIZE (
FILTER (
ALL ( 'Table' ),
'Table'[Group]
IN includingcurrentcategory
&& 'Table'[Category] <> currentcategory
),
'Table'[Group],
'Table'[Category]
)
RETURN
SUMX ( newtable, 1 )
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
@dmitry-wbr , Try a measure like
sumx(values(Table[category]), calculate(distinctCOUNT(Table[group])))
Hi, @amitchandak
Thanks for the reply! Unfortunately, your formula gives incorrect results. Here is the resulting output (should be 5 for categories 1,2 and 4 for category 3):
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |