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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculating monthly average with start date & end date

I need to calculate the number of days taken to complete a request, plus what is the monthly average based on the complexity of the request. 

Basically would like to read the month in the start date & end date then if it was completed in the same month report it as completed and plus its complexity as well.

 

Below is an example of how my data looks. 

Results I want : 

2 medium, 1 Low & 1 high was completed in July

 

PersonComplexityStart DateEnd date

AB

Medium

02/07/2020 11:30:00 AM12/07/2020 14:00:00 PM
ABMedium03/07/2020 11:00:00 AM09/07/2020 15:30:00 AM

TG

High15/07/2020 12:30:00 PM31/07/202011:22:00 AM
NALow10/07/2020 09:00:00 AM12/07/2020 16:01:00 AM
XYLow31/07/2020 09:00:00 AM02/08/2020 14:05:00 PM
OPHigh02/08/2020 09:00:00 AM21/08/2020 15:48:00 PM
OPMedium02/08/2020 12:04:00 PM15/08/2020 5:05:00 PM
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous - Create  a column:

 

Month = FORMAT([End date],"mmmm")

Create another column

MonthSort = MONTH([End date])

 

For Month, specify a sort by column of MonthSort.

 

Now create a visual with Month, Complexity and COUNT of any column or create a COUNTROWS measure.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

 

Thank you everyone for your suggestions. 

@Greg_Deckler I used your solution and it has worked. Thank you 

 

 

AllisonKennedy
Super User
Super User

@Anonymous 

 

Please use @Greg_Deckler  's solution if you want to count XY Low in August, but are you saying that you only want to count the row if the start date and end date are in the same month? 

 

If that's the case, please try this measure: 

 

Total Persons = COUNTAX(FILTER('Table', MONTH('Table'[Start Date]) = MONTH('Table'[End date])), 'Table'[Person])

 
See attached pbix file below signature for setup on how to get this by month. 
 
I do also recommend having a DimDate table for this. https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@Anonymous , You can diff like this

 

datediff([start date], [end date], day) // you can also use hour, minute etc

 

for the month from the date you can use

month([start date])

format([start date], "MMM-YYYY") //Month Year

 

you can use above to create a logic of your choice

Greg_Deckler
Super User
Super User

@Anonymous - Create  a column:

 

Month = FORMAT([End date],"mmmm")

Create another column

MonthSort = MONTH([End date])

 

For Month, specify a sort by column of MonthSort.

 

Now create a visual with Month, Complexity and COUNT of any column or create a COUNTROWS measure.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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