Forum Discussion

Glaeran's avatar
Glaeran
Frequent Visitor
9 years ago
Solved

Show bottom/top value on KPI / Card

Hey!   Here's a quick sneak-peak on my current model:       What I would like to show is a single value Card or KPI for: 1) Top Performing Prodcut Category 2) Worst Performing Product C...
  • v-ljerr-msft's avatar
    9 years ago

    Hi Glaeran,

     

    Have you tried using TOPN function(DAX) to create a new measure to calculate the first/last Product Category Name directly, then just show the measure on a Card in your first try? 

     

    The formula below is for your reference.:smileyhappy:

    First Product Category Name =
    VAR table1 =
        TOPN (
            1;
            'Product Hierarchy Lookup';
            SUMX ( RELATEDTABLE ( POS ); 'POS'[POS_REALIZATION] )
        )
    RETURN
        FIRSTNONBLANK ( table1[PRODUCT_CATEGORY_NAME]; 1 )
    Last Product Category Name =
    VAR table1 =
        TOPN (
            1;
            'Product Hierarchy Lookup';
            SUMX ( RELATEDTABLE ( POS ); 'POS'[POS_REALIZATION] ); 1
        )
    RETURN
        FIRSTNONBLANK ( table1[PRODUCT_CATEGORY_NAME]; 1 )

     

    Regards