sql - Computing a "sprint" based on the current date -


i'm building powerpivot/as data model , need convert date appropriate sprint. sprint defined span of dates (i.e. sprint n = date range date date b). ideally, can add new value field in date hierarchy. how can write dax formula take date , output appropriate sprint?

to make things more complicated, in ideal world different teams can have different dates sprint nice take teamid input , use compute appropriate sprint name given date. note have team/sprint name/sprint start & end dates available querying

i made table looks image below , used date dimension table. teamsprints

i not sure how dynamically calculate sprint based upon parameter indicate team. formula work if make 1 column per team in date table in powerpivot/tabular as.

team1 sprint=calculate(       lastnonblank(teamsprints[sprintname] , 1 ),       filter(           teamsprints,          teamsprints[sprintname] = calculate(                                       lastnonblank( teamsprints[sprintname],1 ),                                        filter(                                           teamsprints,                                           teamsprints[teamid] = 1 &&                                            teamsprints[startdt] <= date[datekey] && teamsprints[enddt] >=date[datekey]                                        )                                    ) &&           teamsprints[teamid] = 1    )    ) 

i figured out based on javier guillen's blog post


Comments