Calculate function on Revenue/expense fields

danhendo888

Board Regular
Joined
Jul 15, 2019
Messages
167
Office Version
  1. 365
Platform
  1. Windows
Append Power Query P05'24 - PQ Test.xlsx
HIJKLMNOPQ
4SumFilteredGrandtotal&ofFilteredGrandCorrect %
5PeriodCountry RERERERE
6P01AUSTRALIA(281,367.56)226,539.96(287,648.55)(287,648.55)97.82%-78.76%27.27%30.44%
7HONG KONG(446,573.35)290,908.66(287,648.55)(287,648.55)155.25%-101.13%43.28%39.10%
8INDIA(259,333.60)200,936.02(287,648.55)(287,648.55)90.16%-69.85%25.14%27.00%
9INDONESIA(44,477.33)25,718.65(287,648.55)(287,648.55)15.46%-8.94%4.31%3.46%
10P01 Total(1,031,751.84)744,103.29(287,648.55)(287,648.55)358.68%-258.68%100.00%100.00%
11
12
13Sum of R and E:(287,648.55)
Start
Cell Formulas
RangeFormula
P6:Q10P6=J6/J$10
J13J13=SUM(J10:K10)


FilteredGrandtotal:=CALCULATE([Sum],ALLSELECTED())
&ofFilteredGrand:=DIVIDE([Sum],[FilteredGrandtotal])

Suppose I have revenue and expense data as below (above is the pivot table from the data model which I've filtered for select countries, for a select month)
And I want to put revenue as a percentage of the filtered revenue total $-1,031,751.84. And expense as a percentage of the filtered expense total $744,103.29

Currently, it is putting revenue as a percentage of the filtered revenue + expense total ($-1,031,751.84 + $744,103.29 = $-287,648.54) and
also putting expense as a percentage of the filtered revenue + expense total ($-1,031,751.84 + $744,103.29 = $-287,648.54)

How would I go about this?

My data looks like this:
R/EAmount
E100
R-10
R-50
E20
E50
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Your filtered grand total amount combines both revenue and expense into a single total (and incorrectly uses ALLSELECTED), yet you indicate you want calculations as a percentage of R and E separately. Also, to haven’t indicated if you have a star schema set up; you definitely should do this.


You need to create 2 grand totals, one each for R and E by adding another filter
CALCULATE(sum,ALL(Table[country]),Table[R/E]=“R”)
 
Upvote 1
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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