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
TJKF
Frequent Visitor

Creating new table from existing two tables

Hi,

 

I have two tables: Market potential and company. I want to create a new table with columns company ID, product group and potential. 

 

When I use
SUMMARIZECOLUMNS(Company[Company ID], 'Market Potential'[Product Group])
I get the right start for the new table. First column with company ID's and each product group once per compay ID.

Now if I add the potential per company and product group to the DAX:
SUMMARIZECOLUMNS(Company[Company ID], 'Market Potential'[Product Group], 'Market Potential'[Potential])
I get all potential and product group combinations to the new table, not just potential based on the company size.

This is obviously the wrong way to do this, but I can't figure out the right way and don't know what to look for for a solution.

 

Example of tables and results:

TJKF_0-1651575793052.png

 

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@TJKF create this table:

 

RESULT = 
SELECTCOLUMNS(
	NATURALINNERJOIN(
		SELECTCOLUMNS(
			'Market Potential',
			"Company size", [Company size] & "",
			"Product Group", [Product Group],
			"Potential", [Potential]
		),
		SELECTCOLUMNS(
			'Company',
			"Company ID", [Company ID],
			"Company size", [Company size] & ""
		
		)
	),
	"Company ID",[Company ID],
	"Product Group", [Product Group],
	"Potential", [Potential]
)

 



In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos.

View solution in original post

6 REPLIES 6
SpartaBI
Community Champion
Community Champion

@TJKF create this table:

 

RESULT = 
SELECTCOLUMNS(
	NATURALINNERJOIN(
		SELECTCOLUMNS(
			'Market Potential',
			"Company size", [Company size] & "",
			"Product Group", [Product Group],
			"Potential", [Potential]
		),
		SELECTCOLUMNS(
			'Company',
			"Company ID", [Company ID],
			"Company size", [Company size] & ""
		
		)
	),
	"Company ID",[Company ID],
	"Product Group", [Product Group],
	"Potential", [Potential]
)

 



In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos.

TJKF
Frequent Visitor

This works as supposed, thank you! 🙂

johnt75
Super User
Super User

Not sure if this will work but you could try

 

New Table = CALCULATETABLE(
SUMMARIZECOLUMNS(Company[Company ID], 'Market Potential'[Product Group], 'Market Potential'[Potential]),
TREATAS( VALUES(Company[Company Size]), 'Market Potential'[Company Size])
)

 

TJKF
Frequent Visitor

Adding the VALUES returns the exact same end result as my original result with just SUMMARIZECOLUMNS. I got solution from another reply. Thank you anyway! 🙂

TJKF
Frequent Visitor

Hi, thank you. It is not working as it is. TREATAS needs a table expression and I don't know which one to use. I tried with company table, but it has a lot of other columns than in the example and I apparently would have to specify them all? I also tried with the market potential, but I get error SummarizeColumns() and AddMissingItems() may not be used in this context.


As you can see, I just don't understand the logic behind this..

 

 

I edited my original post to include a VALUES around the column, give that a try

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.