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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
texranger22
New Member

Subtracting cumulative totals by day

I have a report which looks like this.  It's only 3 months worth of data at the time.  What I'm trying to do is determine the % increase or decrease by row for August vs July and August vs June.  I've also included the code used to generate this data.  Any help would be greatly appreciated.

 

texranger22_0-1661535610274.png

 

Cumulative Value =
var current_date=MAX('Data'[BidDate])
return
SUMX(FILTER(ALLSELECTED('Data'),[BidDate].[Year]=YEAR(current_date)&&[BidDate].[MonthNo]=MONTH(current_date)&&[BidDate]<=current_date),[LoanAmount])
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

see attached for a sample implementation

View solution in original post

9 REPLIES 9
v-yalanwu-msft
Community Support
Community Support

Hi, @texranger22 ;

You also could create a measure :

Percent = 
var _curr=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Business Day in Month]<=MAX('Table'[Business Day in Month])&&[Month]=MAX('Table'[Month])))
var _m7=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Business Day in Month]<=MAX('Table'[Business Day in Month])&&[Month]=EDATE( MAX('Table'[Month]),1)))
var _m8=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Business Day in Month]<=MAX('Table'[Business Day in Month])&&[Month]=EDATE( MAX('Table'[Month]),2)))
return IF(MONTH( MAX('Table'[Month]))=6 , DIVIDE(_m8-_curr,_curr),IF(MONTH(MAX('Table'[Month]))=7,DIVIDE(_m7-_curr,_curr)))

The final show:

vyalanwumsft_0-1661831903220.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the response!  Much appreciated.

lbendlin
Super User
Super User

see attached for a sample implementation

Thank you very much for your help with this. It's exactly what I needed!

texranger22
New Member

BD is business days.  I created a separate table from 1-23 for this since we will never have more than 23 business days in a month.  In the data below we had $2.2B for the first business day in August.  Compared to the first business day in June we are down 11%.  Compared to the first business day in July we are up 338%.  I am trying to get the +/- % by business day for the cumulative total.  Thanks for your assistance with this!

 

texranger22_2-1661773986700.png

 

Please provide sanitized sample data in a usable format.

I just sent a copy of the summarized data.  What I want to do is compare August business day 1 against June business day 1 and the same for August vs July.  It has to be on a cumulative basis though.  Again, thank your for any help.

Business Day in Month6/1/20227/1/20228/1/2022
1 $  2,461,022,717.00 $      499,818,271.00 $  2,191,308,412.00
2 $  3,901,722,283.00 $  4,527,941,865.00 $  2,515,137,106.00
3 $  1,294,461,328.00 $  2,524,263,159.00 $  3,029,697,750.00
4 $  2,219,754,933.00 $  3,122,020,957.00 $  1,823,656,097.00
5 $  3,341,046,886.00 $  1,186,696,529.00 $      574,709,759.00
6 $  2,231,004,513.00 $  1,829,405,496.00 $  1,834,138,878.00
7 $  2,072,561,137.00 $  2,825,871,004.00 $  1,924,493,326.00
8 $      760,458,578.00 $  1,978,916,500.00 $  2,613,725,353.00
9 $  1,882,825,484.00 $  1,788,825,524.00 $  1,593,751,917.00
10 $  2,725,023,776.00 $      904,865,051.00 $      845,692,883.00
11 $  1,289,130,342.00 $  1,758,371,910.00 $  1,499,204,674.00
12 $  3,229,116,111.00 $  2,938,862,313.00 $  2,401,635,782.00
13 $  1,042,928,982.00 $  2,010,728,475.00 $  2,155,295,555.00
14 $  3,481,607,418.00 $  1,912,049,282.00 $  1,828,856,159.00
15 $  1,814,486,750.00 $      948,239,244.00 $      791,856,701.00
16 $  2,505,343,970.00 $  1,363,658,356.00 $  1,542,111,092.00
17 $      958,792,508.00 $  3,171,845,393.00 $  2,173,451,595.00
18 $  2,280,173,745.00 $  1,286,514,756.00 $  2,004,237,839.00
19 $  3,056,160,843.00 $  2,480,985,280.00 $  1,679,763,481.00
20 $  2,742,235,745.00 $  1,296,742,611.00 $  1,282,618,364.00
21 $  2,575,104,791.00  
lbendlin
Super User
Super User

what is BD and how does it tie into your calendar table?

 

Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.