cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarcoLopez Frequent Visitor
Frequent Visitor

time analysis

i have a start date and an end date, and i am trying to count how many days in each month, have each period, i use DATEDIFF, but this just give me the days for 1 month

in example, the start date is 04/may
the end date is 04/july
and i want to know how many days have the period in may and in july.

hope someone can help me.

thank you

10 REPLIES 10
Super User
Super User

Re: time analysis

@MarcoLopez you have to give internal as "DAY", here is more information about datediff

 

 






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

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





MarcoLopez Frequent Visitor
Frequent Visitor

Re: time analysis

thanks for your reply, but if i  just put day, the result is the days in the time period but i need (in the example) the number of days in may and in july, not the total

Super User
Super User

Re: time analysis

@MarcoLopez oh in this case you want to know total number of day in may and in june so which will be 31 days for may and 30 days for june, total 61, is this what you are after?






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

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





MarcoLopez Frequent Visitor
Frequent Visitor

Re: time analysis

yes, thats what im looking for.
thank you

Super User
Super User

Re: time analysis

@MarcoLopez you can add a column something like this

 

Total Days = 
DAY( EOMONTH( Table2[Start], 0 ) )  + DAY( EOMONTH( Table2[End], 0 ) )





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

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





MarcoLopez Frequent Visitor
Frequent Visitor

Re: time analysis

@parry2k thank you, that works for the total days, but didnt  give me the days for each month, I am trying creating columns for each month but i dont get to the correct result

Super User
Super User

Re: time analysis

@MarcoLopez add two seperae column.

 

Days for Start Month = 
DAY( EOMONTH( Table2[Start], 0 ) )  


Days for End Month = 
DAY( EOMONTH( Table2[End], 0 ) )





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

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





MarcoLopez Frequent Visitor
Frequent Visitor

Re: time analysis

@parry2k it didnt work, the expression didnt allow me to select the date column

Super User
Super User

Re: time analysis

@MarcoLopez not sure why, can you share sample data?






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

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Users Online
Currently online: 293 members 3,070 guests
Please welcome our newest community members: