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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Top Kudoed Authors