Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Count Max Sale by User

Hey There Community! I realize this is probably not a complex calculation but the solution is escaping me. I need to count the rows/records by user_id that contain the max id. So in the image belo...
  • JarroVGIT's avatar
    JarroVGIT
    6 years ago

    Ah ok I didn't understood that you wanted to have more information than just the counts of max ID's per User_id in your visual. In that case, add a calculated column to your table like this:

     

    IsMaxIDforUserID = 
    VAR _curID = 'User Group Sales'[id]
    VAR _curUserID = 'User Group Sales'[user_id]
    RETURN IF(MAXX(FILTER('User Group Sales', 'User Group Sales'[user_id] = _curUserID), [id]) = _curID, TRUE, FALSE) 

     

    Then, add that column to the visual filter and filter for True. The column indicates if the current row contains the maximum id for the current userID. 

    Result is this:

    Your PBIX updated is here:

    https://1drv.ms/u/s!Ancq8HFZYL_aiIw3_VDuajJWrCu52w?e=qNrx0g

     

    Please don't forget to like posts that helped you and mark it as the solution if it answered your question. This will help others to find the answers quikcly as well if searching for similar problems 🙂

     

    Kind regards

    Djerro123

    -------------------------------

    If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

    Keep those thumbs up coming! 🙂