Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Glaeran
Frequent Visitor

Show bottom/top value on KPI / Card

Hey!

 

Here's a quick sneak-peak on my current model:

 

 

79f32a8109

 

What I would like to show is a single value Card or KPI for:

1) Top Performing Prodcut Category

2) Worst Performing Product Category

 

Steps taken:
1) Calculate value POS_AMT_LW:

POS_AMT_LW = LOOKUPVALUE(POS[POS_AMT]; POS[END_DATE]; POS[END_DATE_LW]; POS[STORE_ID]; POS[STORE_ID]; POS[PRODUCT_ID]; POS[PRODUCT_ID])

2) Calculate POS_AMT_EXPECTED (we're assuming it's POS_AMT_LW * 1.05:

 

POS_AMT_EXPECTED = IF(POS[POS_AMT_LW] = 0; POS[POS_AMT]; POS[POS_AMT_LW] * 1,05)

3) Calculate POS_REALIZAITON:

 

POS_REALIZATION = IF(POS[POS_AMT_EXPECTED] = 0; 1; POS[POS_AMT] / POS[POS_AMT_EXPECTED])

Sneak-peak on final data:

 

1d71ebf45b

 

Next steps:

 

2572b0dd83

 

However value shown by visual is completely incorrect as it should be for different category..

 

Any idea how to achieve what I would like to achieve or what I'm doing wrong?

 

My second try was to achieve exactly the same thing but using Calculated table:

 

Aggregate = SUMMARIZE(POS; 'Product Hierarchy Lookup'[PRODUCT_CATEGORY_NAME]; POS[END_DATE]; "POS_AMT"; sum(POS[POS_AMT]); "POS_AMT_LW"; sum(POS[POS_AMT_LW]))

With later on calculating POS_REALIZAITON as:

 

POS_REALIZATION = IF('Aggregate'[POS_AMT_LW] = 0; 1; 'Aggregate'[POS_AMT] / ('Aggregate'[POS_AMT_LW]*1,05))

However I'm unable to filter data inside Aggregate table by Slicers or other visuals that are on the report..

 

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

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.Smiley Happy

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

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

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.Smiley Happy

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

Hi! 

 

This does not seem to work for me. I get an error that Table1 does not exist. I'm trying to get the user that has the most candidates. Can you help me with this?


I tried it like this:

Top Name Can = 
VAR table1 =
    TOPN (
        1;
        'CustomerUsers';
        SUMX ( RELATEDTABLE ( Candidates ); 'Candidates'[Count] )
    )
RETURN
    FIRSTNONBLANK ( table1[Name User]; 1 )

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.