Formula Assist DAX

Sonova

New Member
Joined
Feb 21, 2017
Messages
24
Hi

I am trying to calculate a measure which will take my cost category as a percentage of revenue. This is done with the 2 measures below which do not show any errors.

Monthly revenue Calculation
Code:
Revenue Calc:=calculate(sum([Actual]),filter(Categories,Categories[Category]="9"))

As a percentage of revenue.
Code:
% Of Revenue:=calculate(divide(sum([Actual]),[Revenue Calc],0),ALL(Categories[Category],Categories[Category]))

I have a pivot table to material, I would like to see the material cost % proportionate to revenue for the month, however when I add the % Of Revenue measure it does not show anything. It seems that because the pivot table is filtered to material my revenue is not brought in which results in 0% calculation.

https://www.dropbox.com/s/7jd13soh28euohz/FormulaAsssist.PNG?dl=0
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I'm not sure I fully understand, but I can tell you that this formula is semantically flawed

Code:
[COLOR=#333333]Revenue Calc:=calculate(sum([Actual]),filter(Categories,Categories[Category]="9"))[/COLOR]

The issue is you are applying a new filter on Categories[Category] which is added to any other filter already on this column. I would think this would cause a problem. Try this instead

Code:
[COLOR=#333333]Revenue Calc:=calculate(sum([Actual]),filter(ALL(Categories),Categories[Category]="9"))[/COLOR]
 
Upvote 0
I agree with Matt, you need to remove the filters from the Categories table before applying the new filter to show revenue only. You can change your measures to:

Code:
Revenue Calc :=
CALCULATE (
    [Sum Actual],
    FILTER ( ALL ( Categories ), Categories[CategoryKey] = 38 )
)

Code:
% Of Revenue :=
DIVIDE ( [Sum Actual], [Revenue Calc] )
 
Upvote 0

Forum statistics

Threads
1,223,806
Messages
6,174,725
Members
452,578
Latest member
Predaking

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