Forum Discussion
Calculating a Total Based on Start/End Dates
Chelsie Eiden's Duration: https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389
The other reply is technically incorrect, Power BI does support duration formats now.
Greg_DecklerI'm wondering if I confused the issue by calling the column I'm trying to sum "time"?
I've editted my post above.
My issue is when I sum March 2020 I need a formula that uses (for example) the first line for Object D (1.00) and when I sum April 2020 I need it to use the second line for Object D (0.80). I don't think time/duration plays into it?
- Greg_Deckler6 years ago
Community Champion
Now I'm confused, I done understand how you are getting from the sample source data to your desired results.
- Anonymous6 years agoNot applicable
Greg_Deckler
July 2019: N=7, Total ObjectXAttribute=5.257 Objects: A, B, C, D, E, F, G
Sum of ObjectXAttribute = 0.90 + 1.00 + 0.50 + 1.00 + 0.75 + 0.85 + 0.25 = 5.25
Line# Start Date End Date Site Object ObjectAttributeX 1 7/1/2019 5 A 0.90 2 7/1/2019 5 B 1.00 3 7/1/2019 2/29/2020 5 C 0.50 4 3/1/2020 5 C 0.20 5 7/1/2019 3/31/2020 5 D 1.00 6 4/1/2020 5 D 0.80 7 7/1/2019 5 E 0.75 8 7/1/2019 12/31/2019 5 F 0.85 9 7/1/2019 5 G 0.25 March 2020: N=6,Total ObjectXAttribute=4.10
6 Objects: A, B, C, D, E, G
Sum of ObjectXAttribute = 0.90 + 1.00 + 0.20 + 1.00 + 0.75 + 0.25 = 4.10
Line# Start Date End Datw Site Object ObjectAttributeX 1 7/1/2019 5 A 0.90 2 7/1/2019 5 B 1.00 3 7/1/2019 2/29/2020 5 C 0.50 4 3/1/2020 5 C 0.20 5 7/1/2019 3/31/2020 5 D 1.00 6 4/1/2020 5 D 0.80 7 7/1/2019 5 E 0.75 8 7/1/2019 12/31/2019 5 F 0.85 9 7/1/2019 5 G 0.25
April 2020: N=6, Total ObjectXAttribute=3.906 Objects: A, B, C, D, E, G
Sum of ObjectXAttribute = 0.90 + 1.00 + 0.20 + 0.80 + 0.75 + 0.25 = 3.90
Line# Start Date End Date Site Object ObjectAttributeX 1 7/1/2019 5 A 0.90 2 7/1/2019 5 B 1.00 3 7/1/2019 2/29/2020 5 C 0.50 4 3/1/2020 5 C 0.20 5 7/1/2019 3/31/2020 5 D 1.00 6 4/1/2020 5 D 0.80 7 7/1/2019 5 E 0.75 8 7/1/2019 12/31/2019 5 F 0.85 9 7/1/2019 5 G 0.25 - Greg_Deckler6 years ago
Community Champion
OK, spewing numbers at me <> helping.
What is the logic going on here? Why are those numbers included with March 2020 versus April 2020, don't make me try to figure it out, just tell me. The only one that makes sense is July 2019, there are actually 7 rows wtih July 1 2019 as a Start Date. March, I have no idea why there are six March numbers to sum up. There is only one row that matches March 2020. Same for April. So why the magical 6 numbers?
- Anonymous6 years agoNot applicable
If this is all you need I believe you can create a measure using the SUMX function: https://docs.microsoft.com/en-us/dax/sumx-function-dax
I'm not sure why you are using the End date for some sums and the start date for others. This is the part that needs clarification.