Forum Discussion

DennisSchlein's avatar
DennisSchlein
Helper III
1 year ago
Solved

Gross Profit - Measure - with wrong context

Hi 

Im fairly new to dax - and use chat gpt for a lot of my stuff.
So i'm sorry if I don't have a deeper understanding.

Gross Profit = 
CALCULATE(
    [Sum of Sales] - ([Linehaul Amount Cost] + [Lastmile Amount Cost])
    
)



I have this measure - what I want to use to rank my customers.

Customer GP Rank - TOP 10 = 
RANKX(
    ALL('MDS CG1'[CustomerGroupName]),
    CALCULATE([Gross Profit]),
    ,
    DESC,
    DENSE
)


And this works alright :

But if I add another dimension, then it stops working.

Not only does it apply 1 to all customers - and not keeping the rank across all Markets:



  • Hi DennisSchlein ,

    Thank you for reaching out to the Microsoft Community Forum.

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.


    If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

    Thank you

6 Replies

  • Ashish_Excel's avatar
    Ashish_Excel
    Solution Supplier

    Hi,

    Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.

  • v-dineshya's avatar
    v-dineshya
    Community Support

    Hi DennisSchlein ,

    Thank you for reaching out to the Microsoft Community Forum.

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.


    If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

    Thank you

    • v-dineshya's avatar
      v-dineshya
      Community Support

      Hi @DennisSchlein ,

      Thank you for reaching out to the Microsoft Community Forum.

      Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
      Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
      Please show the expected outcome based on the sample data you provided.


      If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

      Thank you

      • v-dineshya's avatar
        v-dineshya
        Community Support

        Hi @DennisSchlein ,

        Thank you for reaching out to the Microsoft Community Forum.

        Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
        Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
        Please show the expected outcome based on the sample data you provided.


        If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

        Thank you