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
dantedg1
Frequent Visitor

Distribute total days in months

Hello,

 

Currently I am working on a project in which we have both a start and an end date as data. How can I distribute the days in months to then graph each month?

For example:

 

Begining Date: January 1st 2018

End Date: April 17 2018

Total days: 107 days

 

Month                     Days

January                     31

February                   28

March                       31

April                         17

 

I would really appreciate the support.

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

 

You may refer to my solution in this PBI file.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Thank you for your support. The problem is that i have lots of data, for example:

 

Begininig Date         End Date             Days

01/01/2018              02/20/2018             51

02/02/2018              02/25/2018             24

01/04/2018              05/05/2018             35

 

Desired output:

 

Days in January= 58

Days in February= 44

Days in March = 0

Days in April = 30

Days in may 5

 

I would really appreciate if you could help me out with this issue. Thanks again.

Hi,

 

That is exactly what my solution will do.  Just add more beginning and ending dates and click on refresh.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MFelix
Super User
Super User

Hi @dantedg1,

 

 

Create a calendar table without any relationship with the fact table then add the following measure:

days =
CALCULATE (
    COUNTROWS ( ALLSELECTED ( DimDate[Date] ) );
    FILTER ( DimDate; DimDate[Date] >= MIN ( Projects[Start Date] ) );
    FILTER ( DimDate; DimDate[Date] <= MAX ( Projects[End Date] ) )
)

Add in a tabel visual the months / years from the Calendar table and the measure final result below:

 

start_end.png

As you can see it works for the full details

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks so muchSmiley Happy

dantedg1
Frequent Visitor

Hello,

 

Currently I am working on a project in which we have both a start and an end date as data. How can I distribute the days in months to then graph each month?

For example:

 

Begining Date: January 1st 2018

End Date: April 17 2018

Total days: 107 days

 

Month                     Days

January                     31

February                   28

March                       31

April                         17

 

I would really appreciate the support.

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.