Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

TopN while using duplicate values

Hi everyone,   I need your help with the following problem. I need to be able to display the topN cargo ID based on their cycle time.  I am trying to use TOPN to display values based on the lowest...
  • Anonymous's avatar
    Anonymous
    3 years ago
    Anonymous I have found a solution.
     
    For anyone interested, here is the measure that uses a slicer to appoint the Top N.
     
    Measure =
     
    VAR a =
        CALCULATETABLE(
            VALUES(
                'Table'[Cargo ID]),
                    TOPN(
                        SELECTEDVALUE(
                            Slicer[Slicer]),
                        ALLSELECTED(
                            'Table'),
                            'Table'[RND Time],
                    ASC)
        )

    VAR selectedCargoID = SELECTEDVALUE ( 'Table'[Cargo ID] )
    RETURN
        IF ( selectedCargoID IN b, 1, 0 )