Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi All,
I have the following tables in my data source.
Element
ElementId | ParentElementId | ElementLevel | ElementName |
1 | 0 | 1 | BB |
2 | 1 | 2 | VS |
3 | 1 | 2 | VD |
4 | 1 | 2 | 22 |
5 | 2 | 3 | VSCS |
6 | 2 | 3 | VSF |
7 | 3 | 3 | VCS |
8 | 3 | 3 | VF |
9 | 4 | 3 | 22CS |
10 | 4 | 3 | 22F |
... | ... | ... | ... |
ElementValueShift
ElementId | Value | ShiftTime |
2 | 76 | 2019-09-28 06:00 |
2 | 50 | 2019-09-28 18:00 |
2 | 44 | 2019-09-29 06:00 |
2 | 12 | 2019-09-29 18:00 |
2 | 78 | 2019-09-30 06:00 |
2 | 31 | 2019-09-30 18:00 |
3 | 67 | 2019-09-28 06:00 |
3 | 5 | 2019-09-28 18:00 |
3 | 44 | 2019-09-29 06:00 |
3 | 21 | 2019-09-29 18:00 |
3 | 87 | 2019-09-30 06:00 |
3 | 13 | 2019-09-30 18:00 |
... | ... | ... |
These two tables are linked by ElementId. Within table Element, the child element is linked to the parent element using ElementId-ParentElementId.
What I would like to do is to calculate the four-shift moving average for each element within each level, where the result will be something like this:
ShiftTime | ElementId | MovingAverage |
2019-09-28 06:00 | 2 | 45.5 |
2019-09-28 18:00 | 2 | 46 |
2019-09-29 06:00 | 2 | 41.25 |
2019-09-28 06:00 | 3 | 34.25 |
2019-09-28 18:00 | 3 | 39.25 |
2019-09-29 06:00 | 3 | 41.25 |
... | ... | ... |
I tried the following:
MovingAverage =
Would it simplify things if you gave each element a composite key that included its parents, like "6-2-1" and then had a level column 3. When you calculate the average it seems like all you care about is the level. To associate an element with a shift/value you just need to identify the precise element, which a composite key would do.
Help when you know. Ask when you don't!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
15 | |
14 | |
11 | |
7 |
User | Count |
---|---|
25 | |
24 | |
12 | |
12 | |
11 |