Forum Discussion
Nepal101
2 years agoHelper III
Calculating days between dates in same column
Hello Everyone, I have a question regarding how to calculate the column or Measure that gives me days between dates Date ClientName salesperson Days Between Running total days or sum days ...
danextian
2 years agoSuper User
Hi Nepal101
Use this instead:
Days Diff =
VAR __PREV =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
'Table',
'Table'[Date] < EARLIER ( 'Table'[Date] )
&& 'Table'[ClientName] = EARLIER ( 'Table'[ClientName] )
&& 'Table'[salesperson] <> "null" )
)
RETURN
DATEDIFF ( __PREV, 'Table'[Date], DAY ) + 0
As to the running total, you can either use a calc column or a measure but calc column is not to be aggregated as it will show incorrect sub or grand total. Please see attached pbix for the details.
Nepal101
2 years agoHelper III
Hello danextian
Thank you so much for your insight.
I have one more question is there a way to coun the days when the sales person is assigned instead of showing 0days
as the sales person was assigned on that paticular day I need to count that day as one to get the correct value.