Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Return Week number based on best week sales

Hi, I have the following table of total sold by Week. I am trying to extract just the Week of the best selling (max total sold from Year to selected date) so that I can put it onto a single value c...
  • Nathaniel_C's avatar
    5 years ago

    Hi Anonymous , try this:

    Highest Week = 
    var _maxSold= MAX(myTable[Total Sold]) // get the highest weekly sold
    
    var _calc =CALCULATE(MAX(myTable[Week]),myTable[Total Sold]=_maxSold)
    
    return _calc


     


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
    Nathaniel

  • Ashish_Mathur's avatar
    5 years ago

    Hi,

    Try these measures:

    Total sales = SUM(Data[Total sold])
    Best selling week = FIRSTNONBLANK ( TOPN ( 1, VALUES ( Data[Week] ), [Total Sales] ), 1 )

  • sktneer's avatar
    5 years ago

    Another way to achieve this...

     

    Assuming the name of your table is Sales then try this...

     

    Week with highest sale =
    CONCATENATEX (
        TOPN (
            1,
            Sales,
            Sales[Total sold]
        ),
        Sales[Week],
        ", ",
        Sales[Total sold], DESC
    )