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

2 Tables back to One - SUMMARIZECOLUMNS

Hi All, 

Looking for advice, I have a table with State based Sales and a number of other attributes. I have used SUMMARIZECOLUMNS to give me National Sales in a new table. I want to use this in my original data to calculate % STATE / NATIONAL for each row.  I need to use all the attributes as filters on the new measure at the State Level.  I am not sure what the next step should be. Can this be solved in DAX? 

 

Thanks 

 

National Data - comes from new table where. 

Country YTD Data= SUMMARIZECOLUMNS(TableName[Month],TableName[Year],TableName[Country],TableName[AttributeA],TableName[AttributeB], ,"CountryYTDNumber",[YTD Number])

 

TableName is the state level detail. 

 

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @AllyOops ,

 

You could create two columns as below.

Column = LOOKUPVALUE('Table (2)'[Australia YTD Sales],'Table (2)'[Product Attribute A],'Table'[Product Attribute A])

Column 2 = 'Table'[DATA YTD Sales]/'Table'[Column]

Result would be shown as below.

2.PNG 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @AllyOops ,

 

You could create two columns as below.

Column = LOOKUPVALUE('Table (2)'[Australia YTD Sales],'Table (2)'[Product Attribute A],'Table'[Product Attribute A])

Column 2 = 'Table'[DATA YTD Sales]/'Table'[Column]

Result would be shown as below.

2.PNG 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@AllyOops ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

@Amit Thanks for your interest. I have tried a number of ways through adding custom column direct to Table 1 but no luck. I seem to only get the out put as a new table which works fine as a single calculation but I am not sure what approach to take to bring the 2 tables back together again. 

 

Following is my data. 

 

Source Table (Table1) 

YearMonthRegionCountryStateCustomer SectorCustomer Type AProduct Attribute ADATA YTD Sales
2019AprOceaniaAustraliaNSWPrivateHEApple150
2019AprOceaniaAustraliaSAPrivateVEOrange50
2019AprOceaniaAustraliaQLDGovernmentSTGrapes99
2019AprOceaniaAustraliaVICPrivateHEApple200
2019AprOceaniaAustraliaTASPrivateVEOrange75
2019AprOceaniaAustraliaWAGovernmentSTGrapes60

 

SUMMARIZECOLUMNS -> New Table

YearMonthCountryCustomer Type AProduct Attribute AAustralia YTD Sales
2019AprAustraliaHEApple350
2019AprAustraliaVEOrange125
2019AprAustraliaSTGrapes159

 

Aiming for this. 

 

YearMonthRegionCountryStateCustomer SectorCustomer Type AProduct Attribute ADATA YTD SalesAustralia YTD SalesPlanned Measure
2019AprOceaniaAustraliaNSWPrivateHEApple15035043%
2019AprOceaniaAustraliaSAPrivateVEOrange5012540%
2019AprOceaniaAustraliaQLDGovernmentSTGrapes9915962%
2019AprOceaniaAustraliaVICPrivateHEApple20035057%
2019AprOceaniaAustraliaTASPrivateVEOrange7512560%
2019AprOceaniaAustraliaWAGovernmentSTGrapes6015938%

 

 

 

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.