Count days between two dates or

bohon79

New Member
Joined
Jul 2, 2015
Messages
45
Hello Everyone,

New to PowerBi and trying to see if this is possible. Trying to count days between two dates or if no end date then keep counting until the end date is filled in. here are my columns that i am trying to count

table name is Award Data
Start Date
End Date

Sometimes i will have a date in the end date column and sometimes not. I know how to get the count between two dates or but not start date to today date.

any help would be appreciated.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Like this?
Book1
ABC
1StartEndDays
201/01/202301/05/20234
301/01/2023103
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=IF(ISBLANK([@End]),TODAY()-[@Start],[@End]-[@Start])
 
Upvote 0
I was looking more or less how to have this in PowerBi or Power query rather than excel. Trying to make this as simple as can be so when i leave the next person just has to get the data and update the spreadsheet and the rest is completed for them
 
Upvote 0
I find spending some time messing around inside an app helps learn how to use it. It took just a couple of minutes to discover that Subtract Days is actually built into the Add Column section under the Date drop down.
Anyway, here's the code in Power BI to produce the table I first posted.
Power Query:
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDJW0gEyTSHMWB0UcaXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Start = _t, End = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Start", type date}, {"End", type date}}),
    InsertedDateSubtraction = Table.AddColumn(ChangedType, "Day", each Duration.Days([End] - [Start]), Int64.Type)
in
    InsertedDateSubtraction
The Source uses the facility to manually create a table. on the fly. It's large icon towards the left side of the Home section in Power BI Query Editor, and the code works in Excel Power Query as well, but in Excel, the Enter Data icon is a tiny one at the far right of the home section.
 
Upvote 0
I was looking more or less how to have this in PowerBi or Power query rather than excel. Trying to make this as simple as can be so when i leave the next person just has to get the data and update the spreadsheet and the rest is completed for them
Are you trying to work out # of Business days? (i.e. exclude weekends) ?

Try creating a custom column with:
Power Query:
=NETWORKDAYS([Start Date],IF([End Date]]= BLANK(),TODAY(),[End Date]))
 
Upvote 0

Forum statistics

Threads
1,215,580
Messages
6,125,654
Members
449,245
Latest member
PatrickL

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