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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JLT
Regular Visitor

How to Calculate Business Days Range with Column Date - URGENT

Hello! 

 

I have a column named 'Time for Testing,' which contains a range of business days representing the required time to conclude a test, and it's in text format. Additionally, I have another column called 'Start Date,' which indicates the beginning of the test and is in date format.

How can I sum these two columns to calculate the completion date?

JLT_0-1709074214749.png

 

Thanks a lot!

 

2 ACCEPTED SOLUTIONS

Hi,

First, you need to convert the 'Time for Testing' column from text format to a numeric value representing the number of business days. If the 'Time for Testing' column contains values like "5-7 days" or "3-5 days", you can extract the range of business days and calculate the average. you can create a new calculated column using the following DAX formula:

TestingDays =
VAR Range = VALUE(MID([Time for Testing], 1, FIND("-", [Time for Testing]) - 1))
RETURN
IF(ISERROR(Range), VALUE([Time for Testing]), (Range + VALUE(MID([Time for Testing], FIND("-", [Time for Testing]) + 1, LEN([Time for Testing])))) / 2)

FYI, Please modify the dax according to your needs, like range and stuff.

 

Once you have the 'TestingDays' column, you can add it to the 'Start Date' column to calculate the completion date. Create another calculated column using the following DAX formula:

 

CompletionDate = [Start Date] + [TestingDays]

View solution in original post

Anonymous
Not applicable

Hi @JLT ,

Please try this way in Power Query :
Here is my sample data:

vjunyantmsft_1-1709085359775.png


Just put all of this M function into Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jZVSEmsLFbSUTLWN7TQNzIwMlGK1UEVNzJAEjfGrl7XDEncDEm9ARZzYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Time for Testing" = _t, #"Start Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Time for Testing", type text}, {"Start Date", type date}}),
    #"Split Column by Positions" = Table.SplitColumn(#"Changed Type", "Time for Testing", Splitter.SplitTextByPositions({0, 3}), {"Time for Testing.1", "Time for Testing.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Positions",{{"Time for Testing.1", Int64.Type}, {"Time for Testing.2", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.AddDays([Start Date], [Time for Testing.1]))
in
    #"Added Custom"

The final output is as below:

vjunyantmsft_0-1709085293872.png

 

Best Regards,
Dino Tao
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

2 REPLIES 2
Anonymous
Not applicable

Hi @JLT ,

Please try this way in Power Query :
Here is my sample data:

vjunyantmsft_1-1709085359775.png


Just put all of this M function into Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jZVSEmsLFbSUTLWN7TQNzIwMlGK1UEVNzJAEjfGrl7XDEncDEm9ARZzYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Time for Testing" = _t, #"Start Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Time for Testing", type text}, {"Start Date", type date}}),
    #"Split Column by Positions" = Table.SplitColumn(#"Changed Type", "Time for Testing", Splitter.SplitTextByPositions({0, 3}), {"Time for Testing.1", "Time for Testing.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Positions",{{"Time for Testing.1", Int64.Type}, {"Time for Testing.2", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.AddDays([Start Date], [Time for Testing.1]))
in
    #"Added Custom"

The final output is as below:

vjunyantmsft_0-1709085293872.png

 

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

First, you need to convert the 'Time for Testing' column from text format to a numeric value representing the number of business days. If the 'Time for Testing' column contains values like "5-7 days" or "3-5 days", you can extract the range of business days and calculate the average. you can create a new calculated column using the following DAX formula:

TestingDays =
VAR Range = VALUE(MID([Time for Testing], 1, FIND("-", [Time for Testing]) - 1))
RETURN
IF(ISERROR(Range), VALUE([Time for Testing]), (Range + VALUE(MID([Time for Testing], FIND("-", [Time for Testing]) + 1, LEN([Time for Testing])))) / 2)

FYI, Please modify the dax according to your needs, like range and stuff.

 

Once you have the 'TestingDays' column, you can add it to the 'Start Date' column to calculate the completion date. Create another calculated column using the following DAX formula:

 

CompletionDate = [Start Date] + [TestingDays]

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors