Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
prakritnepal-cn
Frequent Visitor

Allocate expenses by month to department and sub departments

I am trying to allocate shared expenses to sub departments. my data structure:

Expense categorySub-departmentDepartmentMonth-yearExpenses
cat1sub1dept1Jan-2110
cat2sub1dept1Jan-2110
cat1sub2dept1Jan-2110
cat2sub2dept1Jan-2110
cat1sub3dept1Jan-2110
cat2sub3dept1Jan-2110
cat1sub4dept2Jan-2110
cat2sub4dept2Jan-2110
cat1sub5dept2Jan-2110
cat2sub5dept2Jan-2110
cat1shareddept1Jan-2150
cat2shareddept1Jan-2150
cat1sharedsharedJan-2150
cat2sharedsharedJan-2150

 

I have departments and sub-departments structured in the format above. I have a seperate revenue and COGS calculation by month (Through date table). The above table is connected to date table by date (one date per month), sub department to another table for that sub-department connection. 
I have calculated % of total revenue by department and % of total revenue of everything which looks something like this:

departmentsub% of department revenue% of total revenue
dept1sub120%20%
dept1sub240%20%
dept1sub340%20%
dept2sub450%20%
dept2sub550%20%

% of department revenue formula: 

'financial measures'[recognized revenue]/CALCULATE('financial measures'[recognized revenue],ALLEXCEPT('practice areas','practice areas'[Department]))

 

% of total revenue formula: 

'financial measures'[recognized revenue]/CALCULATE('financial measures'[recognized revenue],ALLEXCEPT('practice areas','practice areas'[sub-department]))
 
I am struggling with allocating the shared expense pieces. The allocation would be two folds, one for just the department, one for shared for both departments. It should look something like this based on revenue splits if both shared expense total to $100
departmentsub% of department revenue% of total revenueDepartment shared allocationTotal shared allocation
dept1sub120%20%$20$20
dept1sub240%20%$40$20
dept1sub340%20%$40$20
dept2sub450%20%$0$20
dept2sub550%20%$0$20
      
Total 200%100%$100.00$100


At the end of the day, I am trying to have sub department expense + departmental shared expense allocation+ total shared expense allocation. 
 
How should I move forward to achieve this? Thanks a lot
 

 

1 ACCEPTED SOLUTION
prakritnepal-cn
Frequent Visitor

Figured out the solution, 

Created a reference table from the original table of expenses and filtered on only shared expenses and linked that to only date table, no joins to expenses or department tables ( so it does not auto filter). 

Model: 

prakritnepalcn_0-1641561466833.png

 

Created two seperate dax for calculating individual departments shared expenses and used the % of revenue formula stated in the original post:

CALCULATE(SUM('expenses-shared'[Expenses]),FILTER('expenses-shared','expenses-shared'[Department]="dept1"),
TREATAS(VALUES('practice areas'[Department]),'expenses-shared'[Department])) * 'OH measures'[% of department revenue]

This gives me shared expenses allocated for department one only split out by month because of date table join and treatas join in the formula with the department (no joins in the model for department between shared expenses and the main expenses table). Exact same thing for dept2. 
Same concept for shared expenses across both departments but without the treatas connection to department as this needs to be allocated across all sub departments: 
CALCULATE(SUM('expenses-shared'[Expenses]),FILTER('expenses-shared','expenses-shared'[Department]="Shared-services")) * 'OH measures'[% of total revenue]
 
 

 

 

View solution in original post

2 REPLIES 2
prakritnepal-cn
Frequent Visitor

Figured out the solution, 

Created a reference table from the original table of expenses and filtered on only shared expenses and linked that to only date table, no joins to expenses or department tables ( so it does not auto filter). 

Model: 

prakritnepalcn_0-1641561466833.png

 

Created two seperate dax for calculating individual departments shared expenses and used the % of revenue formula stated in the original post:

CALCULATE(SUM('expenses-shared'[Expenses]),FILTER('expenses-shared','expenses-shared'[Department]="dept1"),
TREATAS(VALUES('practice areas'[Department]),'expenses-shared'[Department])) * 'OH measures'[% of department revenue]

This gives me shared expenses allocated for department one only split out by month because of date table join and treatas join in the formula with the department (no joins in the model for department between shared expenses and the main expenses table). Exact same thing for dept2. 
Same concept for shared expenses across both departments but without the treatas connection to department as this needs to be allocated across all sub departments: 
CALCULATE(SUM('expenses-shared'[Expenses]),FILTER('expenses-shared','expenses-shared'[Department]="Shared-services")) * 'OH measures'[% of total revenue]
 
 

 

 

v-yetao1-msft
Community Support
Community Support

Hi @prakritnepal-cn 

Could you provide the data in the other tables? The information you provide is not enough to create a calculation formula. If possible, it is recommended to provide the pbix file (delete sensitive information), so that the table data and table relationships can be seen more clearly, so as to better deal with the problem.

 

Best Regard

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.