Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

TOPN in Calculated Column

Aim:
I need to generate a calculated column that show the SUM of the last 6 results by person. 

Context:
Ordinarily do this as a measure, however, due to needing to put the result ( % Diff of Most Recent to Avg of Last 6) in a box and whisker plot it has to be as a calculated column. 

 

Intended Outcome:

NameMost Recent ResultSUM of Last 6AVG of Last 6% Diff of Most Recent to Avg of Last 6
Bob45.91259.1543.026.5%


Data Structure:

  • The relationship between the two tables is on the FT_PlayerID. 
  • The Box & Whisker CMJ Table has been calculated as a summary table with the following DAX: 

 

Box & Whisker CMJ = 
SUMMARIZE(
    'CMJ Results',
    'CMJ Results'[PlayerName],
    Players[FT_PlayerId],
    "Most Recent CMJ", CALCULATE(MAX('CMJ Results'[Max Height]),LASTDATE('CMJ Results'[SessionDate])),
    "Most Recent Session",MAX('CMJ Results'[SessionDate])
)

 

  • The player Index Number in the CMJ results table assigns a sub index so each player's test has an index number - this is so I can calulcate the TOPN off.

Many thanks in advance! 

1 Reply

  • Hi Anonymous ,

     

    What is your table "CMJ Results" looks like?

    Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

    Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

     

    Refer to:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    Best Regards,

    Jianbo Li

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