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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
binayjethwa
Helper IV
Helper IV

How to calculate ROY(Rest of Year) Hours in dax

Hi , 

 

I have the following requirement where i need to calculate ROY(Rest of Year Hours)

 

I have a week start date column and my calendar starts on First monday of July and ends in June. 

 

Based on this condition i need to calculate rest of year hours for the hours column. 

 

I am using below measure but its returning blank. basically what ever dates are finished i need not calculate the sum of those hours only the rest of Year.

 

CALCULATE(
    SUM('Retain Dump'[Retain Hours]),
    FILTER(
        ALL('Retain Dump'),
        'Retain Dump'[Date] > TODAY() &&
        'Retain Dump'[Date] <= DATE(YEAR(TODAY()), 6, 30)
    )
)
 
Is there any other method we can achieve this. Please help.
1 ACCEPTED SOLUTION

Hi @binayjethwa - Oh Ok, if you are using wstart date, please use the updated one below, check it.

 

ROY Hours =
VAR CurrentDate = TODAY()
VAR CurrentYear = YEAR(CurrentDate)
VAR EndOfYearDate =
IF(
CurrentDate > DATE(CurrentYear, 6, 30),
DATE(CurrentYear + 1, 6, 30),
DATE(CurrentYear, 6, 30)
)
RETURN
CALCULATE(
SUM('Retain Dump'[Retain Hours]),
FILTER(
'Retain Dump',
'Retain Dump'[Week Start Date] > CurrentDate &&
'Retain Dump'[Week Start Date] <= EndOfYearDate
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





View solution in original post

4 REPLIES 4
miTutorials
Super User
Super User

There seems to be a problem in your logic, please see the dates it is returning. I guess you are trying to sum Hours until the end of Next year (Jun 2025) ? 

 

miTutorials_0-1720103703888.png

 

rajendraongole1
Super User
Super User

Hi @binayjethwa -Can you try the below measure

ROY Hours =
VAR CurrentDate = TODAY()
VAR EndOfYearDate = DATE(YEAR(CurrentDate), 6, 30)
RETURN
CALCULATE(
SUM('Retain Dump'[Retain Hours]),
FILTER(
'Retain Dump',
'Retain Dump'[Date] > CurrentDate &&
'Retain Dump'[Date] <= EndOfYearDate
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Hi @rajendraongole1  , i am seeing the output as Blank , my date field is basically a week start date.

Hi @binayjethwa - Oh Ok, if you are using wstart date, please use the updated one below, check it.

 

ROY Hours =
VAR CurrentDate = TODAY()
VAR CurrentYear = YEAR(CurrentDate)
VAR EndOfYearDate =
IF(
CurrentDate > DATE(CurrentYear, 6, 30),
DATE(CurrentYear + 1, 6, 30),
DATE(CurrentYear, 6, 30)
)
RETURN
CALCULATE(
SUM('Retain Dump'[Retain Hours]),
FILTER(
'Retain Dump',
'Retain Dump'[Week Start Date] > CurrentDate &&
'Retain Dump'[Week Start Date] <= EndOfYearDate
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.