Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi All,
I'm trying to create a rolling average based on total hours worked.
I need to group it by each day of the week, cost code and by worker.
My hours are in a table along with activity date, worker id and cost code. Each line is an entry against a cost code and a worker might have one line per day or several if they've been working on multiple cost codes.
A worker won't necessarily work every day so some may be blank.
Thanks in advance for any help.
Chris
Solved! Go to Solution.
Hi @owdtelly88,
Try measure as:
Measure =
CALCULATE(
AVERAGEX(FILTER(ALL('Table'),WEEKDAY('Table'[Date])=WEEKDAY(MAX('Table'[Date]))),'Table'[Value]),
DATESINPERIOD('Table'[Date],MAX('Table'[Date]),21,DAY)
)
Here is the output:
The pbix is attached, please try it.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
Hi @owdtelly88,
Try measure as:
Measure =
CALCULATE(
AVERAGEX(FILTER(ALL('Table'),WEEKDAY('Table'[Date])=WEEKDAY(MAX('Table'[Date]))),'Table'[Value]),
DATESINPERIOD('Table'[Date],MAX('Table'[Date]),21,DAY)
)
Here is the output:
The pbix is attached, please try it.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
@owdtelly88 , Based on what I understand
averageX(summarize(Table, [activity date], [worker id] , [cost code] , "_1", [Measure]),[_1])
Thanks for your reponse. How would I incorporate the above into a three week rolling average please? Also, just to clarify, when you mention measure, you mean sum of hours?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 38 | |
| 35 | |
| 25 |