Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello,
I need to forecast work hours distributing the hour through the duration day.
I will use an example to be more clear.
I want to know how many hours per day I will need to work.
How I create a table that looks like the result?
Table1:
Table 2:
Result:
Please Help I have been stuck here for weeks
Solved! Go to Solution.
Hi @EtienneB1 ,
How about create a calculated table like so:
Crossjoin Table =
SUMMARIZE (
FILTER (
ADDCOLUMNS (
CROSSJOIN ( CALENDARAUTO (), 'Table 1', 'Table 2' ),
"enddate", [Start Date]
+ CALCULATE (
SUM ( 'Table 2'[Duration(days)] ) - 1,
FILTER (
ALL ( 'Table 2' ),
'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] )
)
),
"Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
),
VAR StartDate_ = [enddate] - [Duration(days)] + 1
RETURN
[Date] <= [enddate]
&& [Date] >= StartDate_
),
[Date],
[Id],
[Process Name],
[Hours]
)
For more details, please check the attached .pbix file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @EtienneB1 ,
Perhaps this is more helpful to your understanding:
My understanding is this:
You want to calculate the results of “Qty*Time Per Unit/Duration”.
If my understanding is right, try this:
1. Create a calculated column which is to calculate the duration of progress1 and progress2.
duration1 =
CALCULATE (
SUM ( 'Table 2'[Duration(days)] ),
FILTER (
ALL ( 'Table 2' ),
'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] )
)
)
2. Create a new table under Modeling.
Table 3 =
VAR mycalendar =
CALENDARAUTO ()
VAR table1 =
ADDCOLUMNS (
CROSSJOIN ( 'Table 1', 'Table 2', mycalendar ),
"EndDate", 'Table 1'[Start Date] + 'Table 2'[duration1]
)
VAR table2 =
ADDCOLUMNS ( table1, "StartDate1", [EndDate] - 'Table 2'[Duration(days)] )
VAR table3 =
ADDCOLUMNS (
FILTER ( table2, [StartDate1] <= [Date] && [EndDate] >= [Date] ),
"Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
)
RETURN
SUMMARIZE (
ADDCOLUMNS (
table3,
"Hours1", [Qty] & "*" & [Time per Unit(hours)] & "/" & [Duration(days)]
),
[Date],
[Id],
[Process Name],
[Hours1],
[Hours]
)
You can check more details from here.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @EtienneB1 ,
How about create a calculated table like so:
Crossjoin Table =
SUMMARIZE (
FILTER (
ADDCOLUMNS (
CROSSJOIN ( CALENDARAUTO (), 'Table 1', 'Table 2' ),
"enddate", [Start Date]
+ CALCULATE (
SUM ( 'Table 2'[Duration(days)] ) - 1,
FILTER (
ALL ( 'Table 2' ),
'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] )
)
),
"Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
),
VAR StartDate_ = [enddate] - [Duration(days)] + 1
RETURN
[Date] <= [enddate]
&& [Date] >= StartDate_
),
[Date],
[Id],
[Process Name],
[Hours]
)
For more details, please check the attached .pbix file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much for your help.
One more thing, If I have IDs that has different workflow, What I mean that doesn't do all the processes maybe skip one or few.
How I can do it?
Hi @EtienneB1 ,
I don't quite understand the scenario you mentioned. Please give me a specific example to help me better understand your requirements.
Best Regards,
Icey
@EtienneB1 , You can use crosstable with addcolumns, summarize, summarizecolumns
example
addcolumns(crorsstable(Table1, Table2), "Hours" , divide([Qty]*[Time per unit(Hour)],[Duration]))
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |