cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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

Super User IV
Super User IV

@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.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

@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
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors