Forum Discussion
Time intelligence methods for hourly calculations
- Anonymous4 years ago
Hi janislv ,
I tested your measure and I find that it will return the YTD sum of [Measure] after 03/31 by in last year. If you want to do the same with Hourly , I think time intelligence functions don't support you to do this. Try this code.
Here I want to get YTD sum of values after 06/01 8:00:00.
My sample:
Measure:
Measure 3 = VAR _ADD1 = ADDCOLUMNS(ALL('Table'),"Year",YEAR('Table'[Date]),"Month",MONTH('Table'[Date]),"Day",DAY('Table'[Date]),"Hour",HOUR('Table'[Date])) VAR _ADD2 = SUMMARIZE(_ADD1,[Year],"Sum", SUMX(FILTER(_ADD1,[Year]=EARLIER([Year])&&[Month]>=6&&[Day]>=1&&[Hour]>8),[Value])) Return SUMX(FILTER(_ADD2,[Year] = MAX('Daily calendar'[Year])-1),[Sum])Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi janislv ,
I tested your measure and I find that it will return the YTD sum of [Measure] after 03/31 by in last year. If you want to do the same with Hourly , I think time intelligence functions don't support you to do this. Try this code.
Here I want to get YTD sum of values after 06/01 8:00:00.
My sample:
Measure:
Measure 3 =
VAR _ADD1 = ADDCOLUMNS(ALL('Table'),"Year",YEAR('Table'[Date]),"Month",MONTH('Table'[Date]),"Day",DAY('Table'[Date]),"Hour",HOUR('Table'[Date]))
VAR _ADD2 = SUMMARIZE(_ADD1,[Year],"Sum", SUMX(FILTER(_ADD1,[Year]=EARLIER([Year])&&[Month]>=6&&[Day]>=1&&[Hour]>8),[Value]))
Return
SUMX(FILTER(_ADD2,[Year] = MAX('Daily calendar'[Year])-1),[Sum])
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.