Forum Discussion
Anonymous
9 years agoNot applicable
DATESYTD in GROUPBY
I have a calculated table with 5 column, and I need to add the 6th one with the number of Days YTD, my table would look like this: Year School Year Star Date End Date Total Days ...
- 9 years ago
HI Anonymous
This calculated table might be close. Give it a try and let me know what you think.
New Table = SUMMARIZECOLUMNS( 'SchoolDays'[Year], 'SchoolDays'[SY], "Start Date" , MIN('SchoolDays'[CalendarDate]), "End Date" , MAX('SchoolDays'[CalendarDate]), "Total Days" , COUNTROWS('SchoolDays'), "Days YTD" , CALCULATE( COUNTROWS('SchoolDays'), FILTER(ALL('SchoolDays'), 'SchoolDays'[Year] = MAX('SchoolDays'[Year]) && 'SchoolDays'[CalendarDate] < DATE( IF(MONTH(TODAY()) < 8, MAX('SchoolDays'[Year], MAX('SchoolDays'[Year])-1) ), MONTH(TODAY()), DAY(TODAY()) ) ) ) )
Phil_Seamark
Microsoft Employee
9 years agoHI Anonymous
This calculated table might be close. Give it a try and let me know what you think.
New Table = SUMMARIZECOLUMNS(
'SchoolDays'[Year],
'SchoolDays'[SY],
"Start Date" , MIN('SchoolDays'[CalendarDate]),
"End Date" , MAX('SchoolDays'[CalendarDate]),
"Total Days" , COUNTROWS('SchoolDays'),
"Days YTD" , CALCULATE(
COUNTROWS('SchoolDays'),
FILTER(ALL('SchoolDays'),
'SchoolDays'[Year] = MAX('SchoolDays'[Year])
&& 'SchoolDays'[CalendarDate] < DATE(
IF(MONTH(TODAY()) < 8,
MAX('SchoolDays'[Year],
MAX('SchoolDays'[Year])-1)
),
MONTH(TODAY()),
DAY(TODAY())
)
)
)
)Anonymous
9 years agoNot applicable
Thanks, It works, I don't understand yet how, but it does what I needed.
- Phil_Seamark9 years ago
Microsoft Employee
I'm happy to explain any part you need.