Forum Discussion

xcrmadmin's avatar
xcrmadmin
Icon for Helper I rankHelper I
3 years ago
Solved

Top product name per category

How Display Product name as Top selling Product per category and month    Jan Feb March ... ... ... .. ... ... Category X Product X Product Z Product X Product x Product z Produ...
  • bhelou's avatar
    3 years ago

    Hello , please give this a try :

    TopProduct =
    VAR RankingContext = VALUES(DIM_WON_ANALYTICS[Product])
    VAR TopProductSales = CALCULATE([Total Sales], TOPN(1, ALL(DIM_WON_ANALYTICS[Product]), [Total Sales]), RankingContext)
    RETURN
    FIRSTNONBLANK(FILTER(DIM_WON_ANALYTICS, [Total Sales] = TopProductSales), [Product])

    ////// This measure first calculates the total sales for each product in the context of the category and month, then uses the TOPN function to return the product with the highest sales. It then uses the FILTER function to return the first non-blank product name that matches the sales of the top product.

    If it works kindly accept it as a solution