Historical Dep Dates Calculation in Power BI

shansakhi

Active Member
Joined
Apr 5, 2008
Messages
292
Office Version
  1. 365
Platform
  1. Windows
Hello All,
I need your guidenace to calculate historical dates based on Current Dep Date and Last Dep Date in Power BI editor.
Below is the sample data where I used excel formula to calculate historical date (community assisted me to create this excel formula).

Explanation:
1 . For Bus No 101 - Current Dep date is 20-Sep (Fri) and Last Dep Date was 18-Sep (Wed) as 18Sep was Wed, I have to take the first Fri before 18Sep i.e. 13Sep.
2. For Bus No 102 - Current Dep Date is 25-Sep (Wed) and Last Dep Date was 11-Aug (Sun) as 11Aug was Sun, I have to take the First Wed before 11-Aug i.e. 07-Sep.
2. For Bus No 103 - Current Dep Date is 31-Dec (Tue) and Last Dep Date was 20-Mar (Wed) as 20Mar was Wed, I have to take the First Tue before 20-Mar i.e. 19-Mar.

Book1 (006).xlsx
ABCDEF
1Bus NoCurrent Dep DateCurrent DayLast Dep DateFlown DateFlown Day
210120-Sep-24Friday18-Sep-2413-Sep-24Friday
310225-Sep-24Wednesday11-Aug-247-Aug-24Wednesday
410331-Dec-24Tuesday20-Mar-2419-Mar-24Tuesday
Sheet2
Cell Formulas
RangeFormula
E2:E4E2=B2-MAX(0,ROUNDUP((B2-D2)/7,0)*7)
F2:F4,C2:C4F2=TEXT(E2,"DDDD")


Regards,
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
=[Current Dep Date]-List.Max(0,Number.RoundUp(([Current Dep Date]-[Last Dep Date])/7,0)*7)

I am using above formula in Add column - Custom Column but result is Error

Regards,
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,111
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top