cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Measure to count days and show

Hello all,

 

I'm trying to do something that in Excel would be simple, but I can not find a way to do it in PBI.

 

I have a column with project names, and another 4 columns representing its phases (Idea, Business Case, Development, Launch). In each phase column, I have the date the project entered this phase.

 

I want to show how long each project stayed in each phase (eg.: P1 took 30 days from Idea to Business Case, P2 took 20 days from Idea to Business Case).

And I also want to show the average of how long the all projects take to change phase (eg.: Idea to Business Case: 25 days considering only P1 and P2).

 

But my data has a "problem". Some projects do not go through all phases. (eg.: P3 goes from Idea to Development in 40 days).

 

I thought about creating a calculated column and subtract the dates. But I would have a problem with projects that skip phases.

 

Any idea? Or a smarter way to solve it;

 

Best Regards

 

Example

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Measure to count days and show

Hi @Gdps 

 

Firstly, create columns to calculate how long each project stayed in each phase, and create columns to calculate the average of how long the all projects take to change phase.

 

I/B = IF(ISBLANK(Table1[Business Case]),0,DATEDIFF(Table1[Idea],Table1[Business Case],DAY))

 

B/D = IF(ISBLANK(Table1[Development]),0,

IF(ISBLANK(Table1[Business Case]),DATEDIFF(Table1[Idea],Table1[Development],DAY),DATEDIFF(Table1[Idea],Table1[Business Case],DAY)))

 

D/L =

IF(ISBLANK(Table1[Launch]),0,

IF(ISBLANK(Table1[Development]),(

IF(ISBLANK(Table1[Business Case]),DATEDIFF(Table1[Idea],Table1[Launch],DAY),DATEDIFF(Table1[Business Case],Table1[Launch],DAY))),

DATEDIFF(Table1[Development],Table1[Launch],DAY)))

 

AVERAGE I/B = AVERAGE(Table1[I/B])

 

AVERAGE B/D = AVERAGE(Table1[B/D])

 

AVERAGE D/L = AVERAGE(Table1[D/L])

 

Choose table visual to display the result.

 

7.png

 

 

 

 

 

Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Efh-CSBP86pNs-hFDG...

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Measure to count days and show

Hi @Gdps 

 

Firstly, create columns to calculate how long each project stayed in each phase, and create columns to calculate the average of how long the all projects take to change phase.

 

I/B = IF(ISBLANK(Table1[Business Case]),0,DATEDIFF(Table1[Idea],Table1[Business Case],DAY))

 

B/D = IF(ISBLANK(Table1[Development]),0,

IF(ISBLANK(Table1[Business Case]),DATEDIFF(Table1[Idea],Table1[Development],DAY),DATEDIFF(Table1[Idea],Table1[Business Case],DAY)))

 

D/L =

IF(ISBLANK(Table1[Launch]),0,

IF(ISBLANK(Table1[Development]),(

IF(ISBLANK(Table1[Business Case]),DATEDIFF(Table1[Idea],Table1[Launch],DAY),DATEDIFF(Table1[Business Case],Table1[Launch],DAY))),

DATEDIFF(Table1[Development],Table1[Launch],DAY)))

 

AVERAGE I/B = AVERAGE(Table1[I/B])

 

AVERAGE B/D = AVERAGE(Table1[B/D])

 

AVERAGE D/L = AVERAGE(Table1[D/L])

 

Choose table visual to display the result.

 

7.png

 

 

 

 

 

Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Efh-CSBP86pNs-hFDG...

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors