excel formula - DAX Ranking events year over year -
i have table of data has format similar following:
eventid | event date -------------------- 1 | 1/1/2014 2 | 2/8/2014 3 | 10/1/2014 4 | 2/5/2014 5 | 4/1/2014 6 | 9/1/2014
what trying create dax formula rank each event in order happened year. want end this. way can compare events year on year events don't happen on regular time schedule.
event date | year | rank ------------------------ 1/1/2014 | 2014 | 1 2/8/2014 | 2014 | 2 10/1/2014 | 2014 | 3 2/5/2015 | 2015 | 1 4/1/2015 | 2015 | 2 9/1/2015 | 2015 | 3
i have tried creating formula give me day number of year:
day of year =(yearfrac(concatenate("jan 1 ", year([event date])),[event date])*360)+1
then using rankx on table, cant seem proper result. perhaps not understanding use of rankx or going right way.
=rankx(filter(event,earlier(event[event year])=event[event year]),event[day of year])
or
=rankx(all(event[event year]),[day of year],,1,dense)
any ideas appreciated!
thanks in advance!
create following measures:
[year]:=year(lastdate(event[event date]))
and
[rank]:=rankx(filter(all(event),[year]=year(max(event[event date]))),firstdate(event[event date]),,1,dense)
and result get:
note: dates in uk format , suspect yours in format, rankings not appear tally example, work!
Comments
Post a Comment