Forum Discussion

RenataOGardner's avatar
5 years ago
Solved

Dynamic text for TopN

Hello Folks!

I would like to know if it's possible to add a dynamic text box to tell me which are the most sold product when I select a customer?

 

Many thanks,

Renata

  • PC2790's avatar
    PC2790
    5 years ago

    Try using this measure:

    Top10 = SumX(TOPN(10,SUMMARIZE(ProductTable,ProductTable[Product Name],"UnitsSale",[TotalSales]),[UnitsSale],DESC),[TotalSales])

    Put this measure in the values.

    If this doesn't work, try:

    Top10 = TOPN(10,TOPN
    (10,
    SUMMARIZE(
    ProductTable
    ,ProductTable[ProductName],"TotalUnits", SUM(ProductTable[UnitsSold])
    ),"TotalUnits",DESC))

    Additionally, make sure the customer and the product information is related in some way, eiether using a relationship or is part of the same table.

  • Hi RenataOGardner ,

     

    Try this:

    Top 10 Products =
    CONCATENATEX (
        TOPN (
            10,
            SUMMARIZE ( 'Table', 'Table'[Product], "Sales_", [Your Sales Measure] ),
            [Sales_], DESC
        ),
        [Product],
        ", "
    )
    

     

     

    Best Regards,

    Icey

     

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

8 Replies

  • PC2790's avatar
    PC2790
    Community Champion

    Hello,

     

    Try creating a measure similar to below and use it in a card visual:

    BestSellingProduct = MAXX(SUMMARIZE(ProductTable,ProductTable[ProductName],"Sales",[TotalSalesMeasure]),ProductTable[ProductName])

    If this doesn't work for you,please share your sample data

  • RenataOGardner A Text box wont help you in this case. Instead, you should you Card Visuals and put the displaying field on that card.

     

  • Hi, thanks for your reply guys, and sorry if I wasn't clear. What I want here is: when I select the customer on the slicer, I would like to have a text listing the Top10 products based on units. Many thanks!

     

     

    • PC2790's avatar
      PC2790
      Community Champion

      Try using this measure:

      Top10 = SumX(TOPN(10,SUMMARIZE(ProductTable,ProductTable[Product Name],"UnitsSale",[TotalSales]),[UnitsSale],DESC),[TotalSales])

      Put this measure in the values.

      If this doesn't work, try:

      Top10 = TOPN(10,TOPN
      (10,
      SUMMARIZE(
      ProductTable
      ,ProductTable[ProductName],"TotalUnits", SUM(ProductTable[UnitsSold])
      ),"TotalUnits",DESC))

      Additionally, make sure the customer and the product information is related in some way, eiether using a relationship or is part of the same table.

      • analytics_uk's avatar
        analytics_uk
        Helper I

        Hello, thanks for your help.

        I used the second and works pretyr good.

  • Icey's avatar
    Icey
    Community Support

    Hi RenataOGardner ,

     

    Try this:

    Top 10 Products =
    CONCATENATEX (
        TOPN (
            10,
            SUMMARIZE ( 'Table', 'Table'[Product], "Sales_", [Your Sales Measure] ),
            [Sales_], DESC
        ),
        [Product],
        ", "
    )
    

     

     

    Best Regards,

    Icey

     

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