DAX Calculate function

M1donne

New Member
Joined
Apr 7, 2014
Messages
44
Hi all

I have a table of data, effectively sales and stock by week (several weeks in the table), I'm trying to create a calculation to show sales mix in one column and stock mix in another, with the ability to rollup the sales by category , I would normally use the following calculation..

=sales/(sumif(sales (where week=x)) which would give me a % for a particular week which I could then do the same for stock column to get the stock mix.

However I have tried to perform the calculation in my powerpivot table without success and wondered if the DAX CALCULATE Function would achieve the same results.

Anyone know if this is possible?

Regards

M1donne
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
The short answer is : Yes, it can be done :)

I'm a little unclear on what you want to achieve. The % is... the % of total sales that THIS week represents out of the whole (year?) ? or ??
 
Upvote 0
The short answer is : Yes, it can be done :)

I'm a little unclear on what you want to achieve. The % is... the % of total sales that THIS week represents out of the whole (year?) ? or ??


Hi there

thanks for the response.

The end result I'm trying to achieve is to get a %mix of sales (by whatever i choose to slice it by, ie category, region or supplier etc) for a particular week or set of weeks, then compare it to a % mix of stock for the same week(s).

For instance category A sales mix of 40% and stock mix of 20% (as an example) would show this category as over performing with a positive index (40%/20%).

i hope this is clearer.
 
Upvote 0
Okay, I gotcha. I think :)

So... Let's say Categories are on rows of your pivot.

Health & Beauty $200
Alcohol $400
Snacks $300

Total $800. So, Alcohol is 50% of your sales (by category).

Total Sales := SUM(SalesTable[Sales])
ALL Category Sales := CALCULATE([Total Sales], ALL(Categories))
% Category Sales := DIVIDE([Total Sales], [ALL Category Sales])

You can then do similar for stock and divide those two %measures just fine.

Is that what we are going for?
 
Upvote 0

Forum statistics

Threads
1,224,041
Messages
6,176,026
Members
452,697
Latest member
CuriousSpreadsheet

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