# TOTALYTD DAX query problems



## robtop (Oct 23, 2012)

Evening,

I've been having problems getting the TOTALYTD dax expression to work.

I'm using the following expression:

Gross Premium YTD=TOTALYTD(sum([Gross Premium]),time[Date])

According to everything I've read this should work but I'm getting this as the result:

Measure 1: (blank)

Theres no error message but its not summing anything up.

I have got another expression to calculate the premium last year which works without any problems if this helps:

Previous Years Premium:=CALCULATE([Total Gross Premium Ex IPT],DATEADD(time2[Date],-1,YEAR))

Any idea what I'm doing wrong as this is driving me a bit nuts now!

Any help much appreciated

Thanks 

Rob


----------



## Mavericks334 (Oct 25, 2012)

Try this:

First create a measure for the column where the values are: Values_Corrected = Sum[Values]

Then use this measure

=calculate([Value_Corrected],datesbetween(Dates[Date],Year_Period[Selected_Year_Start_Date],Year_Period[Selected_Month_End_Date]))

Create two tables, once which has dates, and the other which has the Year, Month End date, Month Start date. Fiscal Period

Create these two measures in the year period table

Year_Period[Selected_Year_Start_Date] = lastdate(dateadd(Year_Period[Month_End_Date],MAX(Year_Period[Fiscal_Period])*-1,MONTH))
Year_Period[Selected_Month_End_Date]= lastdate(Year_Period[Month_End_Date]).

This should help you out.


----------



## robtop (Oct 25, 2012)

Thanks for the reply, it turns out the measure i was using originally does actually work when i summarise the data in a pivot table or Powerview it's just that for some reason it shows as (BLANK) in the Measures window.

Rob


----------

