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
123456789123456
Frequent Visitor

Calculating budget done from rolling budget left - totals issues

Hi,

 

I got the following data (+ a datetable), describing invoiced budgets within a month + budget left on the end of that month, by invoice. Main goal is to calculate the "budget-done" for each month.

INVmonthnetnet-leftClient
INV101/01/2020200150Client1
INV101/02/2020 50Client1
INV101/03/2020 10Client1
INV201/02/202010090Client1
INV201/03/2020 90Client1
INV301/03/202020 Client1


The expected result are two matrix tables, one with summed up clientdata of delivered budget per month:

Client01/01/202001/02/202001/03/202001/04/202001/05/202001/06/2020Total
Client1501106010000320


And one with details about the invoice

INVnet
INV1200
INV2100
INV320


I tryed a lot of stuff already, this got my the best result, but is still way off the expected result

 

SUM('Table'[net]) 
    - if(
        HASONEVALUE('Table'[net-left]),
        SUM('Table'[net-left])
        ,0
        )
    +CALCULATE(
        CALCULATE(
            SUM('Table'[net-left]),ALLSELECTED(dates)),PREVIOUSMONTH(dates[Date]))

 

Best I got so far with this measure is a Matrix displaying the invoices correctly, but all sums are wrong:

Client01/01/202001/02/202001/03/202001/04/202001/05/202001/06/2020Total
Client15025016010000320
INV150100401000200
INV201009000-80
INV3002000020
Total5025016010000320


Thanks for your help!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @123456789123456 ,

 

Try the following measure:

 

Measure =
SUM ( 'Table'[net] ) - SUM ( 'Table'[net-left] )
    + CALCULATE ( SUM ( 'Table'[net-left] ); DATEADD ( dates[Date]; -1; MONTH ) ) + 0

MFelix_0-1601467973005.png

Check PBIx file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @123456789123456 ,

 

Try the following measure:

 

Measure =
SUM ( 'Table'[net] ) - SUM ( 'Table'[net-left] )
    + CALCULATE ( SUM ( 'Table'[net-left] ); DATEADD ( dates[Date]; -1; MONTH ) ) + 0

MFelix_0-1601467973005.png

Check PBIx file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you for your help.

I actually had this solution at some point, but without the +0, but dropped it as it did not work with my dates table for some reason - filters wont change the visual (e.g. filtering for 2020 only -> 12 columns, instead of 2015-2025 as in my datetable), something I don't see in your pbix, need to look into that. The same issue also occurs when I use excatly your calculated datetable
Any tipps on this particular issue?

 

Thanks again, will mark as solved.

Hi @123456789123456 ,

 

Be aware that I only used a sample data with information for 2020, so my calendar is limited for that time frame. Believe that the way things are setup can work with more years, however your data mockup was pretty reduced, if you want please send out a broader sample and I can check if it works properly.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I don't speak Spanish, but I think I understand it now: the way you build the data table is different from my approach (which is actually a dataflow of data to keep all reports at exactly the same level). For now I'll just adapt to your dating solution
thanks again

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.