Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to calculate number of days between replies?

Hey everyone!

I've been given a challenge and so far I can't wrap my head around it, even though it looks so simple in theory.

I have a table with a series of replies back and forth between the dealer and an auditor. Each row has 3 columns:

  • ID_Action - ID where are replies belong to, integer

  • Comments_Date - Date of the comment, date

  • Comments_Owner - Who replied, string (audit or dealer)

My goal is to calculate the average number of days it took for the audit to reply to the dealer (days between last dealer comment and first audit comment), per id_action.

Example of the table is:

ID_ActionComments_DateComments_Owner
101-01-2016Dealer
105-01-2016Audit
106-01-2016Audit
114-02-2016Dealer
114-02-2016Dealer
128-02-2016Audit
207-07-2018Audit
218-07-2018Audit
225-07-2018Dealer

 

And the expected shoud be something like this:

ID_ActionComments_DateComments_OwnerDays between replies
101-01-2016Dealer0
105-01-2016Audit4
106-01-2016Audit0
114-02-2016Dealer0
114-02-2016Dealer0
128-02-2016Audit14
207-07-2018Audit0
218-07-2018Dealer0
225-07-2018Audit7
227-07-2018Dealer0

 

I've searched around here and here but none of these apply to my scenario.

So far, I am yet to calculate the last reply date for the audit replies, considering thats necessary in order to calculate the difference in days. This is what i got in a calculated column:

 

Last Audit Reply = 
MAXX(
    FILTER(
        'Comentários - Histórico',
        'Comentários - Histórico'[ID_ACTION] = EARLIER('Comentários - Histórico'[ID_ACTION])
            && 'Comentários - Histórico'[COMMENTS_OWNER] = "AUDIT"
    ),
    'Comentários - Histórico'[COMMENTS_DATE]
)

 

But as you probably noticed, this returns the same value for each row of the same id_action (28-02-2016 for id_action 1 and 25-07-2018 for id_action 2), as I can't force the date to be lower than the next Dealer reply.

 

Any help would be much appreciated!

 

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

2 REPLIES 2
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1630458153611.png

 

Anonymous
Not applicable

Thank you so much, this is exactly what I needed!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.