Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

power bi calculating

Forum home » Delegate support and help forum » Microsoft Excel Training and help » POWER BI - calculating durations

POWER BI - calculating durations

ResolvedVersion 365

POWER BI - calculating durations

Hello

I have a table that contains Deal ID (unique value), date of deal, Activity ID (unique values) and date of activity. There is a one to many relationship between Deal ID and Activity ID.

I want to calculate the time between date of deal and date of activity, but only for the first completed activity of each deal.

Deal ID Date of deal Activity ID Date of activity
A 01/01/2019 1 06/01/2019
A 01/01/2019 2 03/01/2019
A 01/01/2019 3 15/02/2019
B 02/03/2019 4 04/03/2019
B 02/03/2019 5 08/03/2019
C 16/02/2019 6 25/02/2019
C 16/02/2019 7 20/02/2019
C 16/02/2019 8 21/02/2019
C 16/02/2019 9 28/02/2019

In the above example, Deal A has 3 associated activities, and Activity 2 was the first completed activity

Deal B has 2 associated activities, and Activity 4 was the first completed activity

Deal C has 4 associated activities, and Activity 7 was the first completed activity

The reason I'm asking is that we have a KPI that says any activity must be within 2 days of deal date - so I'm only interested on the first activity. Does that make sense?

RE: POWER BI - calculating durations

Hi Brett,

Thank you for the forum question.

To got the date of the first activity I created a column calculation in the many table (the table where you have the data above) see dax below. The dax will return the first date for each activity for each deal id. You then just need to calculate [FirstActivity]-[Date of Deal]


FirstACtivity = CALCULATE(MIN(Table1[Date of Activity]),FILTER(Table1,Table1[Deal Id]=EARLIER(Table1[Deal Id])))


I hope this makes sense.

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Fri 8 Mar 2019: Automatically marked as resolved.

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.