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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Hours needed by remaining Months in the billable year

Hi I'm trying to write a measure that would show me how many hours are need each month to get to an expected billable. 

 

I work at a law firm and the billable year is 2020-11-1 to 2021-10-31. 

 

I have a measure that tells me the expected hours, I  have another measure that tells me how many hours has be worked hour has been billed to date

 

I created a measure 

Hours Needed = CALCULATE([2021 Expected Hours]-[2021 Billable Hours])- This tells me how many hours they need to get to the expected hours. 
 
But now I want to divide that by the number of months left in the billable year and this is where I'm getting lost.  I know there are three months left this year but is there a measure I could write that would 
 
Example would be 
 
2021 Expected Hours 2000
Year To Date Hours 1320
Hours need- 680
 
I want a measure that would break down the 680 to how many hours is needed for the remainding months.  I know I can just divide the 680/3 but is there a measure that would calculate the remaining months for me. 
 
Thanks
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @Anonymous 

 

You can use "DATEDIFF" DAX code.

Try this measure:

 

remaining months =
VAR _Today =
    TODAY ()
VAR _ENdOfBY =
    DATE ( YEAR ( _Today ), 10, 31 )
VAR _RD =
    DATEDIFF ( _Today, _ENdOfBY, MONTH )
RETURN
    IF ( _Rd < 0, ABS ( _RD ) + 10, _RD )

It will calculate the remaining month between Today and end of  billable year, so now it will return 2 because we are in the middle of August, so if you want to consider the current month in your calculation (to return3), just add +1 at the end of the last row [ IF ( _Rd < 0, ABS ( _RD ) + 10, _RD )+1].

 

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

Appreciate your Kudos VahidDM_0-1629847138584.png !!

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @Anonymous 

 

You can use "DATEDIFF" DAX code.

Try this measure:

 

remaining months =
VAR _Today =
    TODAY ()
VAR _ENdOfBY =
    DATE ( YEAR ( _Today ), 10, 31 )
VAR _RD =
    DATEDIFF ( _Today, _ENdOfBY, MONTH )
RETURN
    IF ( _Rd < 0, ABS ( _RD ) + 10, _RD )

It will calculate the remaining month between Today and end of  billable year, so now it will return 2 because we are in the middle of August, so if you want to consider the current month in your calculation (to return3), just add +1 at the end of the last row [ IF ( _Rd < 0, ABS ( _RD ) + 10, _RD )+1].

 

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

Appreciate your Kudos VahidDM_0-1629847138584.png !!

Anonymous
Not applicable

@VahidDM Thank you

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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