4 Replies Latest reply on Oct 4, 2016 11:31 PM by Rohan Malusare

# Calculation for YTD range

Hi Experts,

I am facing difficulties in building logic for  YTD range.

To control dashboard I am using 2 parameter as follows :

Parameter for Financial year.(String Format) (Added from Table)

Parameter for Month (Date Format) (Added from Table)

I am using this calculation but it is not giving expected output of YTD range.

[Date Month]>=[Date Finyr] and

[Date Month]<=DATEPARSE('yyyyMM',(if INT([Param_Months])<=3/01/2016 then STR(INT(LEFT([Param_financial_year],4))+1) else LEFT([Param_financial_year],4) END) +[Param_Months])

Can someone guide me on the same?

• ###### 1. Re: Calculation for YTD range

Hi Rohan! Just to be sure, what is the first month of your fiscal year? And can you upload a packaged workbook for us to see?

In general, I think the easiest way to calculate the beginning of the fiscal year is to subtract the number of months in the latter year and then grab the resulting year and use that to build the date. For instance, let's say that your fiscal year starts in July and you're working with an extract. You could do this:

MAKEDATE(YEAR(DATEADD('month', -6, [The Date])), 7, 1)