DAX: Family Total next to each Item Total

im2fast4u

New Member
Joined
Dec 20, 2012
Messages
2
I have several tables in a relational DB format in PowerPivot. One table contains the sales for each item. Another Master table contains a list of families.
I would like to create a Pivot table column (PowerPivot) with an expression that shows the SUM OF SALES BY FAMILY for each row of item.
What kind of PowerPivot DAX expression will get me the result in colum 4 (Family Sales)

ItemFamilyItemSalesFamilySales
1211$100$400
2173$200$900
2522$400$1700
4562$800$1700
3721$300$400
3243$700$900
7622$500$1700

<tbody>
</tbody>
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I will be speaking in terms of measures (aka calculated fields)... a calc column would be different.

FamilySales := CALCULATE(SUM(SalesTable[ItemSales]), ALLEXCEPT(SalesTable, SalesTable[Family]))

Which is basically, gimme the sum of itemsales, but strip away ALL filter context... except the Family column.

Depending on pivot table / slicers, that may remove too many filters. Could also try something like:
FamilySales := CALCULATE(SUM(SalesTable[ItemSales]), ALL(SalesTable[Item]))

Which will only strip away filter context for the Item id column.
 
Upvote 0
Hi,

Apply Pivot table as per below. This will gives you sum of Item sales and Family sales by row in Pand Q column.

Row Lables - Family
Values - Sum of item sales & Sum of Family sales
Column Lables - Item


Note - In Column lables Values will reflect auto you need to put Item column up.
 
Upvote 0
I will be speaking in terms of measures (aka calculated fields)... a calc column would be different.

FamilySales := CALCULATE(SUM(SalesTable[ItemSales]), ALLEXCEPT(SalesTable, SalesTable[Family]))

Which is basically, gimme the sum of itemsales, but strip away ALL filter context... except the Family column.

Depending on pivot table / slicers, that may remove too many filters. Could also try something like:
FamilySales := CALCULATE(SUM(SalesTable[ItemSales]), ALL(SalesTable[Item]))

Which will only strip away filter context for the Item id column.


Thank you very much Scottsen for a very quick feedback! The solution that you provided would surely work if my data was arranged hierarchically in rows like 'ItemFamily>Item'. But I would like to develop a flat looking (kind of iSeries) report where the first column is Item, second column is ItemFamily, third column is SumSales and fourth column is FamilySales. All this is flat and no hierarchy like it can be done in a Pivot table, just like the table I had in the original post.

Thank you very much again!
 
Upvote 0
In the power pivot window when you insert a pivot table, one of the options is to insert a "flattened pivot table". That should give what you want.
 
Upvote 0

Forum statistics

Threads
1,217,272
Messages
6,135,587
Members
449,947
Latest member
AmyB2212

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top