The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have some data for deliveries and weight that I would like to aggregate into a rolling sum for each delivery line.
I tried the below code, but it is only presenting the row
This is what I have now for Measure:
LoadWeight Aggregate =
CALCULATE(
SUM('fact HCLoads'[LoadWeight]),
FILTER (
all('fact HCLoads'[DeliveryDateTime].[date]),
'fact HCLoads'[DeliveryDateTime].[Date] >= MIN('fact HCLoads'[DTMinus12].[Date])
&& 'fact HCLoads'[DeliveryDateTime].[DATE] <= MAX('fact HCLoads'[DTPlus12].[DATE]
)))
Load Weight | Delivery Date | Delivery Date -12 | Delivery Date + 12 | Rolling 24 hr sum |
5 | 1/1/2020 0:13 | 12/31/2019 12:13 | 1/1/2020 12:13 | 10 |
5 | 1/1/2020 3:47 | 12/31/2019 15:47 | 1/1/2020 15:47 | 10 |
6 | 1/3/2020 1:57 | 1/2/2020 13:57 | 1/3/2020 13:57 | 6 |
7 | 1/5/2020 1:10 | 1/4/2020 13:10 | 1/5/2020 13:10 | 24 |
8 | 1/5/2020 1:58 | 1/4/2020 13:58 | 1/5/2020 13:58 | 24 |
9 | 1/5/2020 3:01 | 1/4/2020 15:01 | 1/5/2020 15:01 | 24 |
7 | 1/7/2020 1:28 | 1/6/2020 13:28 | 1/7/2020 13:28 | 7 |
Dave
@SuperFave , I have not got it completely.
But try like
CALCULATE(
SUM('fact HCLoads'[LoadWeight]),
FILTER (
all('fact HCLoads'[DeliveryDateTime]),
'fact HCLoads'[DeliveryDateTime] >= MIN('fact HCLoads'[DeliveryDateTime]) -time(24,0,0)
&& 'fact HCLoads'[DeliveryDateTime] <= MAX('fact HCLoads'[DTPlus12].[DATE]
)))