Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hi good day,
Can anyone help me if it possible to distribute the hours from start to end date of certain activity.
DESIRED OUTPUT
OR
Thank you
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI00jfUNzQCsUxhLFMDpVidaCUjiLQRVNpI3xjKMgDKxwIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [activity = _t, start = _t, end = _t, hours = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"activity", Int64.Type}, {"start", type date}, {"end", type date}, {"hours", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each List.Dates([start], Duration.Days([end] - [start]) + 1 , #duration(1, 0, 0, 0))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Hours Per day", each [hours] / List.Count( [Date] )),
#"Expanded Date" = Table.ExpandListColumn(#"Added Custom1", "Date"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Date",{"start", "end", "hours"})
in
#"Removed Columns"
from
To
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Activity", Int64.Type}, {"Hours", Int64.Type}, {"Est Stat Date", type date}, {"Est End Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {Number.From([Est Stat Date])..Number.From([Est End Date])}),
#"Inserted Date Subtraction" = Table.AddColumn(#"Added Custom", "Remaining hours", each [Hours]/(Duration.Days([Est End Date] - [Est Stat Date])+1)),
#"Removed Columns" = Table.RemoveColumns(#"Inserted Date Subtraction",{"Hours", "Est Stat Date", "Est End Date"}),
#"Expanded Custom" = Table.ExpandListColumn(#"Removed Columns", "Custom"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Activity", Int64.Type}, {"Custom", type date}, {"Remaining hours", type number}})
in
#"Changed Type1"
Hope this helps.
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Activity", Int64.Type}, {"Hours", Int64.Type}, {"Est Stat Date", type date}, {"Est End Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {Number.From([Est Stat Date])..Number.From([Est End Date])}),
#"Inserted Date Subtraction" = Table.AddColumn(#"Added Custom", "Remaining hours", each [Hours]/(Duration.Days([Est End Date] - [Est Stat Date])+1)),
#"Removed Columns" = Table.RemoveColumns(#"Inserted Date Subtraction",{"Hours", "Est Stat Date", "Est End Date"}),
#"Expanded Custom" = Table.ExpandListColumn(#"Removed Columns", "Custom"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Activity", Int64.Type}, {"Custom", type date}, {"Remaining hours", type number}})
in
#"Changed Type1"
Hope this helps.
You are welcome.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI00jfUNzQCsUxhLFMDpVidaCUjiLQRVNpI3xjKMgDKxwIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [activity = _t, start = _t, end = _t, hours = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"activity", Int64.Type}, {"start", type date}, {"end", type date}, {"hours", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each List.Dates([start], Duration.Days([end] - [start]) + 1 , #duration(1, 0, 0, 0))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Hours Per day", each [hours] / List.Count( [Date] )),
#"Expanded Date" = Table.ExpandListColumn(#"Added Custom1", "Date"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Date",{"start", "end", "hours"})
in
#"Removed Columns"
from
To
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
98 | |
61 | |
47 | |
36 | |
34 |