Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi, using the table1, how do I get every combination like in table2 please?
Table1
System | Location |
Laptop | Newcastle |
Laptop | Newcastle |
Newcastle | |
Manchester | CRM |
Manchester | CRM |
Manchester | CRM |
Table2
System | Location | Count |
Laptop | Newcastle | 2 |
Newcastle | 1 | |
CRM | Newcastle | 0 |
Laptop | Manchester | 0 |
Manchester | 0 | |
CRM | Manchester | 3 |
Thanks
Solved! Go to Solution.
Hey there!
You can achieve the result in Power BI / DAX or SQL by generating every possible combination of System and Location, and then counting the occurrences.
Use the following DAX formula to create a new table in Power BI:
Table2 =
VAR Systems = VALUES(Table1[System])
VAR Locations = VALUES(Table1[Location])
RETURN
ADDCOLUMNS(
CROSSJOIN(Systems, Locations),
"Count", COUNTROWS(FILTER(Table1, Table1[System] = EARLIER([System]) && Table1[Location] = EARLIER([Location])))
)
What this does:
VALUES(Table1[System]) → Gets unique systems
VALUES(Table1[Location]) → Gets unique locations
CROSSJOIN() → Creates all possible combinations
COUNTROWS() → Counts occurrences of each pair
Hope this helps!
😁😁
Thanks for the solution and explanation!! 🙂
Hi @RichOB - You can achieve this in Power BI using a cross join to get all possible combinations of System and Location, followed by a COUNTROWS measure to count occurrences.
Proud to be a Super User! | |
Hey there!
You can achieve the result in Power BI / DAX or SQL by generating every possible combination of System and Location, and then counting the occurrences.
Use the following DAX formula to create a new table in Power BI:
Table2 =
VAR Systems = VALUES(Table1[System])
VAR Locations = VALUES(Table1[Location])
RETURN
ADDCOLUMNS(
CROSSJOIN(Systems, Locations),
"Count", COUNTROWS(FILTER(Table1, Table1[System] = EARLIER([System]) && Table1[Location] = EARLIER([Location])))
)
What this does:
VALUES(Table1[System]) → Gets unique systems
VALUES(Table1[Location]) → Gets unique locations
CROSSJOIN() → Creates all possible combinations
COUNTROWS() → Counts occurrences of each pair
Hope this helps!
😁😁
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.