Simple DAX Formula (CALCUATE & ALL) problem perplexing me

eljetfan

New Member
Joined
Sep 1, 2015
Messages
2
Hello,

I am new to PowerPivot and BI. Here is a sample data table which I will call TABLE. The Calculated Field is what I am trying to fill in. I hardcoded the expected values that I would expect from my calculated field.

[TABLE="width: 429"]
<tbody>[TR]
[TD]Campaign_ID[/TD]
[TD]Location[/TD]
[TD]Amount[/TD]
[TD]Calculated Field (expected Value)[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Mexico[/TD]
[TD]5[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Mexico[/TD]
[TD]5[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]US[/TD]
[TD]10[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]US[/TD]
[TD]5[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]US[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Canada[/TD]
[TD]5[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Germany[/TD]
[TD]5[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Brazil[/TD]
[TD]5[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Canada[/TD]
[TD]5[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I want to calculate a new field where I sum up all the amount values for a given campaign ID. In simple Excel, it would be SUMIF Amount where Campaign=1 or equal to 30 that waterfalls down the table.

I can then divide the amount for a given row by the calculated field to get the weight of each location for a given campaign ID. For example, Mexico has a weight of 5/30 for campaign_id=1 and US = 10/30 for campaign_id=1, etc. etc. (There is a deeper calculation off this calculated weight that I won't elaborate on).

First, I created a measure called Total Amount as Total Amount = sum([Amount])

I then created the following DAX Formula as a Calculated Field:

=CALCULATE ([Total Amount],ALL(TABLE,[Campaign_ID]))

When I use this formula, I only get the value for each cell, not the sum of the array for the campaign row value that I am on.

I have trade all sorts of flavors of FILTER, CALCULATETABLE, etc and I either get the sum of the entire array or and ERROR message.

Any idea where I am going wrong? I am perplexed because it appears to me to be a simple sumif in excel for on each campaign ID down the table.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,224,115
Messages
6,176,479
Members
452,729
Latest member
fizzay_pop

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