Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

DAX Dynamic table / context

Hi,   I'm getting stuck on a DAX formula when creating dynamic table based on this requirement: -Getting all rows where the [AsOfDate] is lesser or equal to the date selected -Getting all rows wh...
  • Anonymous's avatar
    Anonymous
    2 years ago

     A colleague of mine found working and more elegant solution. No need to create a DAX table, just to get the RANK in a measure, to filter the visuals accordingly (rank = 1) and to remove the relationship with the Data table.


     

    Rank = 
    ROWNUMBER (
        FILTER(
            ALL(Sheet1),
            [AsOfDate] <= MINX(ALLSELECTED('Date'), [Start of Month])
                && [LaunchYear] = MINX(ALLSELECTED('Date'), [Year]) - 1
        ),
        ORDERBY([AsOfDate], DESC),
        LAST,
        PARTITIONBY([ID])
    )