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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to disaggregate a total amount into lower levels

Hey all,

 

Having trouble figuring out the DAX here. Want to create a calculated column that will disaggregate the paid to date for a lawsuit by the separate invoices. For Example: $1000 has been paid out for Lawsuit Key Value 1. There are 4 invoices for that lawsuit, thus in column 5 the value needs to be 250 for Lawsuit Value 1. What is the DAX formula here? Thanks all! Pic below.

dax.PNG

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Hi,

 

Goal =
[Amount paid to date for law suit]
    / CALCULATE (
        COUNTROWS ( TableName ),
        ALLEXCEPT ( TableName, TableName[Lawsuitkey] )
    )

Regards
Zubair

Please try my custom visuals

View solution in original post

Anonymous
Not applicable

Here's the formula for your column:

 

Percent Change = 
var __actual = TableName[Actual Paid to Date Spread]
var __budgeted = TableName[Budgeted for Lawsuit]
var __percentChangeFromBudgeted =
    DIVIDE(
        __actual - __budgeted,
        __budgeted
    )
return
    __percentChangeFromBudgeted

Please always precede the name of a column with the name of the table it belongs to and never precede the name of a measure with the name of the table it belongs to.

 

Second, the formula does not multiply by 100 because this is not how it should work. It returns a number and you have to format it as percentage using the formatting group in the ribbon:

Formatting Ribbon in Power BI.PNG

Hope this helps.

 

Best

Darek

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Hi,

 

Goal =
[Amount paid to date for law suit]
    / CALCULATE (
        COUNTROWS ( TableName ),
        ALLEXCEPT ( TableName, TableName[Lawsuitkey] )
    )

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Hey @Zubair_Muhammad  One more question. What then would be the DAX formula to calculate the percent change between the amount paid and the amount budgeted. The formula is in the picture I've attached. You've been a tremendous help!

 

Best.

 

percent change actual and budget.PNG

Anonymous
Not applicable

Here's the formula for your column:

 

Percent Change = 
var __actual = TableName[Actual Paid to Date Spread]
var __budgeted = TableName[Budgeted for Lawsuit]
var __percentChangeFromBudgeted =
    DIVIDE(
        __actual - __budgeted,
        __budgeted
    )
return
    __percentChangeFromBudgeted

Please always precede the name of a column with the name of the table it belongs to and never precede the name of a measure with the name of the table it belongs to.

 

Second, the formula does not multiply by 100 because this is not how it should work. It returns a number and you have to format it as percentage using the formatting group in the ribbon:

Formatting Ribbon in Power BI.PNG

Hope this helps.

 

Best

Darek

Anonymous
Not applicable

@darlove

 

How can I calculate then instead of just disaggregating the budget amount evenly across invoices, how can I calculate the percent the invoice is to the total net amount for invoices charged to that specific lawsuit and then divide the budget based upon that percent?

Anonymous
Not applicable

Have a look at this:

 

https://www.daxpatterns.com/budget-patterns/

 

Best

Darek

Anonymous
Not applicable

Beautiful. Thanks @Zubair_Muhammad 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors