Forum Discussion

santoshlearner2's avatar
santoshlearner2
Icon for Resolver II rankResolver II
3 years ago
Solved

Need Help - Calculating Sales when category is upgraded

I am a learner, learning from all of you wonderful people. I am stuck with a problem tried all the ways but cannot get it.

I have 4 categories of salespeople Ranked as per the highest

1) Diamond(Top Category)

 2)) Gold (2nd)

3) Silver (3rd)

4)  Bronze (4th)

Have sales figures likes this

Category / Sub Category/ Sales ID  / Sales Person.

Wanted to know if there are 3 people in Silver category, in April 23, the supervisor moved them on May 23 to Gold then what was the incremental / lower business done.

Sales ID is Unique,  Out of all people in silver category, 3 people in April 23 figures were like this

 ID 1 – 100

ID 2- 240

ID 3- 124

If in May 23 since their boss moved them to upper category for eg gold their figures become like this

 ID 1 – 120

ID 2- 250

ID 3- 140

Incremental nos is 46 with count 3, similary even after moving them up if they don’t done anything when what is the cumulative figures.

 

Thanks every one

  • Do you have a 'Category' table which defines which category a salesperson is in in each month?  Something like this:

    SalesPersonIDCategoryMonth
    1SilverApr-2023
    2SilverApr-2023
    3SilverApr-2023
    4SilverApr-2023
    1GoldMay-2023
    2GoldMay-2023
    3GoldMay-2023
    4SilverMay-2023

     

    If you don't, then I think this is what you need to be able to make progress.  I would have the [Month] column actually as a date (start of the month) as this will make it easier to join to your existing sales data table.  Specifically, I would join in Power Query as follows:

     

    Add a [Start of Month] column to your sales data

    From your sales data, merge on both Sales.[SalesPersonID] <-> Category.[SalesPersonID] and Sales.[Start of Month] <-> Category.[Month]

    Expand & just keep [category]

     

    From your 'Category' table, you'll also need to generate a 'Category Changes' table.  I would also do this in Power Query by:

    Duplicating the 'Category' table

    Renaming the [Category] column in this table to [Previous Category]

    Adding a [Start of Previous Month] colmn

    Joining this back to your catgory table on SalesPersonID <-> SalesPersonID and Month <-> [Start of Previous Month]

    Filtering on  [Category] <> [Previous Category]

     

    Happy to expand on any of the above if you need more detail.  I've just given an overview & am not sure how comfortable you are in Power Query already.

     

  • Thank you for your help, it was very sweet of you to do so.  Highly appreciate.

    Thank you

12 Replies

  • Do you have a 'Category' table which defines which category a salesperson is in in each month?  Something like this:

    SalesPersonIDCategoryMonth
    1SilverApr-2023
    2SilverApr-2023
    3SilverApr-2023
    4SilverApr-2023
    1GoldMay-2023
    2GoldMay-2023
    3GoldMay-2023
    4SilverMay-2023

     

    If you don't, then I think this is what you need to be able to make progress.  I would have the [Month] column actually as a date (start of the month) as this will make it easier to join to your existing sales data table.  Specifically, I would join in Power Query as follows:

     

    Add a [Start of Month] column to your sales data

    From your sales data, merge on both Sales.[SalesPersonID] <-> Category.[SalesPersonID] and Sales.[Start of Month] <-> Category.[Month]

    Expand & just keep [category]

     

    From your 'Category' table, you'll also need to generate a 'Category Changes' table.  I would also do this in Power Query by:

    Duplicating the 'Category' table

    Renaming the [Category] column in this table to [Previous Category]

    Adding a [Start of Previous Month] colmn

    Joining this back to your catgory table on SalesPersonID <-> SalesPersonID and Month <-> [Start of Previous Month]

    Filtering on  [Category] <> [Previous Category]

     

    Happy to expand on any of the above if you need more detail.  I've just given an overview & am not sure how comfortable you are in Power Query already.

     

    • santoshlearner2's avatar
      santoshlearner2
      Icon for Resolver II rankResolver II

      It was very sweet of you to reply.   I Have the following tables

      Table One:  known as  Category Table; Which has Sales ID, Month, and the category. In this table the category names are mentioned like gold, silver, bronze, 

       

       

      Table 2; Known as Sales Table

      Has the sales data like Sales ID, Month, Sales Figures, but does not have category.

       

      Now the Problem i am facing is,  Sales people who are say in the lower category and in any given month they get upgraded to the next level or higher level, wanted to know the count of those people  who are upgraded , on upgrading them what is the sales numbers, 

      Pls note the sales table does not have the category, it is in the category table, both have the month, / Sales ID,  

       

      Hope i explained correctly. Thanks for your time

      • whitch's avatar
        whitch
        Icon for Resolver I rankResolver I

        Yes, generating a 'Category Changes' table, as outlined in my previous response, would solve both your problems.

    • santoshlearner2's avatar
      santoshlearner2
      Icon for Resolver II rankResolver II

      Thank you for your help, it was very sweet of you to do so.  Highly appreciate.

      Thank you

  • By Category.[SalesPersonID], I mean the [SalesPersonID] column in the 'Category' table.

  • Hi,

    Share some data (in a format that can be pasted in an MS Excel file) and show the expected result very clearly.

  • Sorry for the inconvenience. If it is taken time, pls ignore will tell the boss i cant do it. Thanks for your reply.

     

    In the sales table, sales person category for that respective month is not mentioned, it is there in the category table.  in the below examples

    ID-1 in Apr-23 was in Gold Category, and ID-2 was in Silver category, but in June 2023, (Kindly refer the category table highligted in red) ID-1 and ID-2 gets upgraded to Diamond and Platinum Respectively. Wanted to know the result expected is

     

    Result: In June-23 on Moving them to the next Category the visual i want is this

    MonthCategoryOld CategoryNew CategoryTota Count Total Sales
    Jun-23 GoldDiamond1110
    Jun-23 SilverPlatinum1120

    Ie actual sales of June-23 for ID-1 and ID-2, the number of sales people will be more, so wanted to know category wise count ( Of the changes) and total sales of those people for that month after moving them to the next category

    Sales Table

    Sales IDMonthSales
    ID-1Apr-2310
    ID-2Apr-2320
    ID-3Apr-2330
    ID-4Apr-2340
    ID-5Apr-2350
    ID-1May-2360
    ID-2May-2370
    ID-3May-2380
    ID-4May-2390
    ID-5May-23100
    ID-1Jun-23110
    ID-2Jun-23120
    ID-3Jun-23130
    ID-4Jun-23140
    ID-5Jun-23150

     

    Category table:

    Sales IDMonthCategory
    ID-1Apr-23Gold
    ID-2Apr-23Silver
    ID-3Apr-23Bronze
    ID-4Apr-23Platinum
    ID-5Apr-23Diamond
    ID-1May-23Gold
    ID-2May-23Silver
    ID-3May-23Bronze
    ID-4May-23Platinum
    ID-5May-23Diamond
    ID-1Jun-23Diamond
    ID-2Jun-23Platinum
    ID-3Jun-23Bronze
    ID-4Jun-23Platinum
    ID-5Jun-23Diamond
    • santoshlearner2's avatar
      santoshlearner2
      Icon for Resolver II rankResolver II
      Sales ID (This is sales table)MonthSales
      ID-1Apr-2310
      ID-2Apr-2320
      ID-3Apr-2330
      ID-1May-2360
      ID-2May-2370
      ID-3May-2380
      ID-1Jun-23110
      ID-2Jun-23120
      ID-3Jun-23130

       

      Sales table above.

       

      Category table

      Sales IDMonthCategory
      ID-1Apr-23Gold
      ID-2Apr-23Silver
      ID-3Apr-23Platinum
      ID-1May-23Gold
      ID-2May-23Silver
      ID-3May-23Platinum
      ID-1Jun-23Diamond
      ID-2Jun-23Platinum
      ID-3Jun-23Platinum
      • santoshlearner2's avatar
        santoshlearner2
        Icon for Resolver II rankResolver II

        Hi

        Have sent the table in the previous reply.

        Sorry for the inconvenience. If it is taken time, pls ignore will tell the boss i cant do it. Thanks for your reply.

         

        In the sales table, sales person category for that respective month is not mentioned, it is there in the category table.  in the below examples

        ID-1 in Apr-23 was in Gold Category, and ID-2 was in Silver category, but in June 2023, (Kindly refer the category table highligted in red) ID-1 and ID-2 gets upgraded to Diamond and Platinum Respectively. Wanted to know the result expected is

         

        Result: In June-23 on Moving them to the next Category the visual i want is this

        MonthCategoryOld CategoryNew CategoryTota Count Total Sales
        Jun-23 GoldDiamond1110
        Jun-23 SilverPlatinum1120

        Ie actual sales of June-23 for ID-1 and ID-2, the number of sales people will be more, so wanted to know category wise count ( Of the changes) and total sales of those people for that month after moving them to the next category

         

        Sales ID (This is sales table)MonthSales
        ID-1Apr-2310
        ID-2Apr-2320
        ID-3Apr-2330
        ID-1May-2360
        ID-2May-2370
        ID-3May-2380
        ID-1Jun-23110
        ID-2Jun-23120
        ID-3Jun-23130

         

        Sales table above.

         

        Category table

        Sales IDMonthCategory
        ID-1Apr-23Gold
        ID-2Apr-23Silver
        ID-3Apr-23Platinum
        ID-1May-23Gold
        ID-2May-23Silver
        ID-3May-23Platinum
        ID-1Jun-23Diamond
        ID-2Jun-23Platinum
        ID-3Jun-23Platinum
  • Thank you for your help, it was very sweet of you to do so.  Highly appreciate.

    Thank you