Find first day of the year

Hi,
My requirement (for a report) is to check whether the first day of the time period is the first day of the year. I created a calculated measure using the following formula;

iif(
[Measures].[Time Period First Day] = ‘Jan 01 2020’ ,
Sum(
PreviousPeriods([Time].CurrentHierarchyMember),[Measures].[Issues created] –
[Measures].[Issues resolved]
) ,
0
)

It is working fine as long as I select year 2020 in page dimension. But I want to make it dynamic i.e. if I select any other year the above measure should check with the first date of other year.

Appreciate help on the matter.

Hi @ARVINDKS
Welcome to our community.

Try this more flexible code for the first day of the period calculation.

iif(
  [Measures].[Time Period First Day]
=
[Time].[Day].Datemember(
Ancestor([Time].CurrentMember,[Time].[year]).startdate
).Name,
  Sum(
    PreviousPeriods([Time].CurrentHierarchyMember),
    [Measures].[Issues created] - [Measures].[Issues resolved]
    ),0
  )

Martins / eazyBI team