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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Running Total for workdays

I need some help about making a different calculation.

I have a dataset like that.

 

Screenshot_8.pngScreenshot_9.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The first table shows how much spent did i for each day, and the second table shows what is the opening target for this month.

The target value only shows the value for first day of month. To calculatate other days target, substract the sum of OUTGO Values.

Example for this dataset to target calculation.

Target For         TargetCalculated
1.1.2018     ---- 2445
2.1.2018     ---- 2445 - 34 = 2411
3.1.2018     ---- 2445 - 34 - 53 = 2358
4.1.2018     ---- 2445 - 34 - 53 - 48 = 2310
...
.
.

(The targets in the month table is completly independent from another table)

I want to make a calculation like that,

Firstly it will calculate for each date, how many workdays have after that till the end of month.

(The workdays logic is like that

Monday1
Tuesday1
Wednesday1
Thursday1
Friday1
Saturday1
Sunday0,3

 

)

 

The example dataset for this calculation.

 

Screenshot_5.png





 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


After 

It will divide for each day the TargetCalculation and the remaining workdays value.

The expected values for January 2018 first 4 days,

Date              NewCalculation
1.1.2018     ----  86,7021 (2445/28,2)
2.1.2018     ----  88,6397 (2411/27.2)
3.1.2018     ----  90          (2358/26.2)
4.1.2018     ---- 91,6667  (2310/25.2)


Pbix File 

 

 

 

 

 

 

3 ACCEPTED SOLUTIONS
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to below steps:

Created two columns in 'Master Data' table:

Column = CALCULATE(MAX('Target Data'[TARGET]),FILTER('Target Data','Target Data'[MONTH]='Master Data'[Month]))
Column 2 = [Column]-CALCULATE(SUM('Master Data'[OUTGO]),FILTER('Master Data','Master Data'[Date]<EARLIER('Master Data'[Date])&&'Master Data'[Month]=EARLIER('Master Data'[Month])))
1.PNG
Create a relationship between below tables:
1.PNG
Create a column in 'Example Data' table:
Related Column = DIVIDE(RELATED('Master Data'[Column 2]),'Example Data'[Column5])
Result:
1.PNG
You could also download the pbix file to have a view.
 
Regards,
Daniel He
Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Firstly thank you for your reply.

It looks like fine but one case was missed.

 

Actually i don't have ExampleData table. I was added it for show to 'column5' calculation logic.

I have to make this calculation in MasterData table.

In summary this solution is okey but i need to create a new column like 'Column5' in MasterData table.

View solution in original post

Hi @Anonymous,

Based on my test, you could refer to below steps:

Enter a map table like below:

1.PNG

Create a week number column in 'Master Data' table:

Weeknum = WEEKDAY('Master Data'[Date],2)

Create relationship between two tables:

1.PNG

Create below calculated columns:

Column 3 = RELATED(Map[value])
Column 4 = CALCULATE(SUM('Master Data'[Column 3]),FILTER('Master Data','Master Data'[Date]>=EARLIER('Master Data'[Date])&&'Master Data'[Month]=EARLIER('Master Data'[Month])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

 

 

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

View solution in original post

3 REPLIES 3
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to below steps:

Created two columns in 'Master Data' table:

Column = CALCULATE(MAX('Target Data'[TARGET]),FILTER('Target Data','Target Data'[MONTH]='Master Data'[Month]))
Column 2 = [Column]-CALCULATE(SUM('Master Data'[OUTGO]),FILTER('Master Data','Master Data'[Date]<EARLIER('Master Data'[Date])&&'Master Data'[Month]=EARLIER('Master Data'[Month])))
1.PNG
Create a relationship between below tables:
1.PNG
Create a column in 'Example Data' table:
Related Column = DIVIDE(RELATED('Master Data'[Column 2]),'Example Data'[Column5])
Result:
1.PNG
You could also download the pbix file to have a view.
 
Regards,
Daniel He
Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Firstly thank you for your reply.

It looks like fine but one case was missed.

 

Actually i don't have ExampleData table. I was added it for show to 'column5' calculation logic.

I have to make this calculation in MasterData table.

In summary this solution is okey but i need to create a new column like 'Column5' in MasterData table.

Hi @Anonymous,

Based on my test, you could refer to below steps:

Enter a map table like below:

1.PNG

Create a week number column in 'Master Data' table:

Weeknum = WEEKDAY('Master Data'[Date],2)

Create relationship between two tables:

1.PNG

Create below calculated columns:

Column 3 = RELATED(Map[value])
Column 4 = CALCULATE(SUM('Master Data'[Column 3]),FILTER('Master Data','Master Data'[Date]>=EARLIER('Master Data'[Date])&&'Master Data'[Month]=EARLIER('Master Data'[Month])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

 

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.