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
Anonymous
Not applicable

CROSSJOIN by group

hi all,

Hopefully you can help me. I can't figure it out despite googling a lot. I don't think it's very tricky.

Basically, what I want to achieve is a kind of grouped crossjoin between two identical tables.

Table A

StopsStations
A - B - CA
A - B - CB
A - B - CC
X - YX
X - YY

 

Table B

StopsStations
A - B - CA
A - B - CB
A - B - CC
X - YX
X - YY

 

The result should be (column naming can be different):

StopsStationsStopsStations
A - B - CAA - B - CA
A - B - CAA - B - CB
A - B - CAA - B - CC
A - B - CBA - B - CA
A - B - CBA - B - CB
A - B - CBA - B - CC
A - B - CCA - B - CA
A - B - CCA - B - CB
A - B - CCA - B - CV
X - YXX - YX
X - YXX - YY
X - YYX - YX
X - YYX - YY

 

I need to do that in order to report on certain routes, let's say customer satisfaction between point A and B oder A and C.

I hope you can help me 🙂

 

Best regards,

Troji

1 ACCEPTED SOLUTION
Anonymous
Not applicable

// Assumption:
// No relationship between the tables.

GENERATE(
	'Table A',
	var __stop = 'Table A'[Stop]
	return
	SELECTCOLUMNS(
		CALCULATETABLE(
			VALUES( 'Table B'[Stations] ),
			'Table B'[Stop] = __stop
		),
		"B Stations",
			'Table B'[Stations]
	)
)

View solution in original post

6 REPLIES 6
vivran22
Community Champion
Community Champion

Hello @Anonymous,

 

Please follow the link below:

 

https://community.powerbi.com/t5/Desktop/Help-a-noobie-column-combination/m-p/946976#M453788

 

I am hopeful this is what you are looking for.

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

Anonymous
Not applicable

Thank you for your answer, @vivran22 

Unfortunately, this seems also to produce a full CROSSJOIN.

I'd need a CROSSJOIN grouped by column "Stations" (as shown in the example result table).

 

This should be possible with DAX, doesn't seem to hard! I just can't get my head around it.

 

 

Anonymous
Not applicable

This should be dead easy with GENERATE or GENERATEX.

Best
D
Anonymous
Not applicable

// Assumption:
// No relationship between the tables.

GENERATE(
	'Table A',
	var __stop = 'Table A'[Stop]
	return
	SELECTCOLUMNS(
		CALCULATETABLE(
			VALUES( 'Table B'[Stations] ),
			'Table B'[Stop] = __stop
		),
		"B Stations",
			'Table B'[Stations]
	)
)
Anonymous
Not applicable

thank you so much@Anonymous !
this seems to produce the table I was looking for! I don't think I would have come up with that solution, so "dead simple" maybe for you 😆

 

thank you community!

 

Anonymous
Not applicable

Use lookupvalue function.
Thanks
Pravin

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.