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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
milindwasekar
New Member

Top 1 KPI Card for Selected Group

factinternetsales is my Fact table and DimProduct is dimension table which is connected with fact table by product key . I created slicer for various dimesions like Productline ,Model name ,size,color,class,calendar year as field parameter from table DimProduct .

I want top one Sales as kpi card so that  when I select any group like Productline ,Mode name ,size,color,class,calendar year KPI card should show Top1 from each Selected field from dropdown .

 

milindwasekar_0-1734021405628.png

milindwasekar_0-1734021868060.png

 

 

1 ACCEPTED SOLUTION
v-heq-msft
Community Support
Community Support

Hi @milindwasekar ,
Based on your description, I created some test data

DimProduct

ProductID ProductLine Color
1001 A Blue
1002 A Blue
1003 A Red
1004 A Red
1005 B Red
1006 B Red
1007 B Green
1008 C Green
1009 C Green
1010 D Green
1011 D Orange
1012 D Orange
1013 E Orange
1014 E Orange

FactInternetSales

ProductID SalesAmount
1001 12
1002 24
1003 15
1004 42
1005 13
1006 47
1007 46
1008 52
1009 45
1010 78
1011 32
1012 11
1013 46
1014 31

Create calculate column in DimProduct

Color_Rank = 
VAR _rank = 
RANKX(
    ALL(DimProduct[Color]),
    CALCULATE(
        SUM(FactInternetSales[SalesAmount]),
        ALLEXCEPT(DimProduct, DimProduct[Color])
    ),
    ,
    ASC
)
RETURN
CONCATENATE(_rank,[Color])
ProductLine_Rank = 
VAR _rank = 
RANKX(
    ALL(DimProduct[ProductLine]),
    CALCULATE(
        SUM(FactInternetSales[SalesAmount]),
        ALLEXCEPT(DimProduct, DimProduct[ProductLine])
    ),
    ,
    ASC
)
RETURN
CONCATENATE(_rank,[ProductLine])

Create filed parameter based on calculated columns

Parameter = {
    ("Color_Rank", NAMEOF('DimProduct'[Color_Rank]), 0),
    ("ProductLine_Rank", NAMEOF('DimProduct'[ProductLine_Rank]), 1)
}

Create KPI visualiztion

vheqmsft_0-1734066980171.png

Final output

vheqmsft_1-1734066993534.png

vheqmsft_2-1734067004342.png

Best regards,
Albert He


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

View solution in original post

1 REPLY 1
v-heq-msft
Community Support
Community Support

Hi @milindwasekar ,
Based on your description, I created some test data

DimProduct

ProductID ProductLine Color
1001 A Blue
1002 A Blue
1003 A Red
1004 A Red
1005 B Red
1006 B Red
1007 B Green
1008 C Green
1009 C Green
1010 D Green
1011 D Orange
1012 D Orange
1013 E Orange
1014 E Orange

FactInternetSales

ProductID SalesAmount
1001 12
1002 24
1003 15
1004 42
1005 13
1006 47
1007 46
1008 52
1009 45
1010 78
1011 32
1012 11
1013 46
1014 31

Create calculate column in DimProduct

Color_Rank = 
VAR _rank = 
RANKX(
    ALL(DimProduct[Color]),
    CALCULATE(
        SUM(FactInternetSales[SalesAmount]),
        ALLEXCEPT(DimProduct, DimProduct[Color])
    ),
    ,
    ASC
)
RETURN
CONCATENATE(_rank,[Color])
ProductLine_Rank = 
VAR _rank = 
RANKX(
    ALL(DimProduct[ProductLine]),
    CALCULATE(
        SUM(FactInternetSales[SalesAmount]),
        ALLEXCEPT(DimProduct, DimProduct[ProductLine])
    ),
    ,
    ASC
)
RETURN
CONCATENATE(_rank,[ProductLine])

Create filed parameter based on calculated columns

Parameter = {
    ("Color_Rank", NAMEOF('DimProduct'[Color_Rank]), 0),
    ("ProductLine_Rank", NAMEOF('DimProduct'[ProductLine_Rank]), 1)
}

Create KPI visualiztion

vheqmsft_0-1734066980171.png

Final output

vheqmsft_1-1734066993534.png

vheqmsft_2-1734067004342.png

Best regards,
Albert He


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.