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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
bonitatem
Regular Visitor

Calculate Invoice Allocations with Multiple Levels of Filtering

I have two tables - one with software license usage by department and user; the second with invoice data for the different licenses.  I'm trying to allocate the invoice costs to the different departments based on license usage.

 

I'd like to take the number of users that are assigned a specific license within a department and divide by the total number of users who use that license in the organization and then multiply by the sum of the invoiced $'s for that license.  Then I want to sum those calculated dollars for all licenses to get total license cost by department, but also be able to drill down to see the costs that specific users or licenses are accruing for a team.

 

Here's some sample data:

 

DepartmentDisplayNameLicense
1000User227Microsoft - Business Premium
1000User288DocuSign
1000User288Microsoft - Business Premium
1000User431DocuSign
1000User431Microsoft - Business Premium
1001User294Microsoft - Business Premium
1001User294Microsoft - Power BI Pro
1001User325Microsoft - Business Premium
1001User368Microsoft - Power BI Pro

 

MonthTotal to AllocateVendor / Invoice Type
45292100DocuSign
45292200Microsoft - Business Premium
4529225Microsoft - Power BI Pro
45323100DocuSign
45323175Microsoft - Business Premium
4532350Microsoft - Power BI Pro

 

If I were doing this in Excel for each license I would use a combination of COUNTIF and SUMIF to generate a table like this below (though I'd want to be able to drill down one more layer to see cost/user).

DepartmentMicrosoft - Business PremiumDocuSignMicrosoft - Power BI ProTotal
10002252000425
1001150075225

 

For reference, here's one of the formulas in Excel: =(COUNTIFS(Licenses_All[Department],$A3,Licenses_All[License],"Microsoft - Business Premium")/COUNTIF(Licenses_All[License],"Microsoft - Business Premium"))*SUMIF(Software_Assurance_Allocations[Vendor / Invoice Type],"Microsoft - Business Premium",Software_Assurance_Allocations[Total to Allocate])

 

I've tried a number of different DAX expressions to replicate, but here's the current iteration:

Allocation_Amount = DIVIDE(COUNT(Licenses_All[Department]),CALCULATE(COUNT(Licenses_All[Department]),ALLSELECTED(Licenses_All[Department]))) * SUM('Software_Assurance_Allocations'[Total to Allocate])

This expression correctly calculates the allocation for each license by department, but provides the incorrect results for the Totals column (it's aggregating the data instead of summing the data for each individual license - I'm not sure how to add that into the expression) and also doesn't work when I drill down to see individual users (the DIVIDE half of the expression is returning 1, so it's displaying the total license cost).
 
Thank you for your help!
1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

ThxAlot_2-1710885977968.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

1 REPLY 1
ThxAlot
Super User
Super User

ThxAlot_2-1710885977968.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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