Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Top/Bottom/All on table based on slicer selection

Hi Everyone,   i have a table visual which has Account Name, current period revenue and previous period revenue as values.  I need to give 2 slicers . 1) to select Top/Bottom/All 2) to select nu...
  • wdx223_Daniel's avatar
    3 years ago
    Top/Bottom Account =
    SWITCH (
        SELECTEDVALUE ( 'Top/Bottom - Account'[Selection] ),
        "All", 1,
        "Top",
            IF (
                MAX ( 'Sales'[Account Name] )
                    IN CALCULATETABLE (
                        VALUES ( 'Sales'[Account Name] ),
                        TOPN (
                            SELECTEDVALUE ( 'Drop Down - Account'[Values] ),
                            ALLSELECTED ( 'Sales'[Account Name] ),
                            [Current Period Revenue], DESC
                        )
                    ),
                1
            ),
        IF (
            MAX ( 'Sales'[Account Name] )
                IN CALCULATETABLE (
                    VALUES ( 'Sales'[Account Name] ),
                    TOPN (
                        SELECTEDVALUE ( 'Drop Down - Account'[Values] ),
                        ALLSELECTED ( 'Sales'[Account Name] ),
                        [Current Period Revenue], ASC
                    )
                ),
            1
        )
    )