Forum Discussion
Anonymous
2 years agoNot applicable
Running Total for a calculated measure
Hello,
I created a measure to find the time difference between two timestamps. The timestamps table looks like this:
I used this formula to create a measure that calculates the time difference between these two columns:
Duration = DATEDIFF(MIN(Source[Appeared]), MIN(Source[Disappeared]), MINUTE) +
(SECOND(MIN(Source[Disappeared])) - SECOND(MIN(Source[Appeared]))) / 60
All the values are correct, but the table or the graph is not giving me the total.
It does not even let me make changes to the data to make it a total. Even when I try doing the Running total quick measure, it does not work. Do you know what I can do to get a total for this?
You will need to use SUMX, Like the example below. Note that I use the entire "Source" table as table expression. That will not give you the best performance, you might want to replace that with a column expression that matches the cardinality of the rows, maybe something like VALUES('Source'[Source ID]) .
SUMX('Source', CALCULATE( DATEDIFF(MIN(Source[Appeared]), MIN(Source[Disappeared]), MINUTE) + (SECOND(MIN(Source[Disappeared])) - SECOND(MIN(Source[Appeared]))) / 60 ))