Forum Discussion

donodackal's avatar
donodackal
Helper I
4 years ago
Solved

Help creating new DAX Column

Hi there

 

The below table is a summary of multiple invoices summed up against the supplier. I would like to create a new column that broadly categories each supplier based on their Total Spend (The Total Spend is another measure I included that sum up all invoices for a supplier). So, for every supplier and based on their Total Spend, the new column should tag them as:

Suppliers with a Total Spend of over $1,000,000 will have "million-dollar club" in the new column; 

Suppliers with a Total Spend between $200,000 to $1,000,000 will have "200K to 1M club" in the new column;

Suppliers with a Total Spend between $25k to $200k will have "25k to 200k club" in the new column; or

Suppliers with a Total Spend below $25k will be called "Penny value club"

 

Can I get help creating the correct DAX to add this column? Appreciate all your help.

 

Below is an example of the table:

Supplier NameCount of Invoice Number Average of Invoice Amount  Total Spend 
Supplier 11315 $                                1,756.87 $ 2,310,278.59
Supplier 2629 $                                2,768.35 $ 1,744,059.58
Supplier 3614 $                                2,011.89 $ 1,235,298.43
Supplier 4157 $                                6,152.17 $    965,890.41
Supplier 523 $                              35,729.16 $    821,770.74
Supplier 6288 $                                2,564.16 $    738,477.08
Supplier 749 $                              13,240.31 $    648,775.00
Supplier 8224 $                                2,617.42 $    586,301.55
Supplier 930 $                              19,007.90 $    570,236.90
Supplier 10365 $                                1,484.28 $    541,762.80
Supplier 1149 $                              10,586.39 $    518,732.95
Supplier 1236 $                              13,916.86 $    501,007.00
Supplier 1367 $                                6,646.60 $    445,322.50
Supplier 1473 $                                5,371.14 $    392,093.50
Supplier 15104 $                                3,631.42 $    377,667.95
Supplier 1624 $                              15,688.75 $    376,530.00
Supplier 17567 $                                    618.96 $    350,951.52
Supplier 182 $                            174,240.00 $    348,480.00
Supplier 1916 $                              21,059.38 $    336,950.00
Supplier 2032 $                              10,105.95 $    323,390.36
Supplier 2149 $                                6,391.70 $    313,193.50
Supplier 22189 $                                1,600.50 $    302,494.94
Supplier 23374 $                                    761.91 $    284,953.25
Supplier 2486 $                                3,292.18 $    283,127.11
Supplier 2542 $                                5,772.45 $    242,442.75
Supplier 26471 $                                    481.15 $    226,623.37
Supplier 27214 $                                1,036.00 $    221,705.00
Supplier 28410 $                                    531.77 $    218,027.00
Supplier 29122 $                                1,754.88 $    214,094.92
Supplier 3032 $                                6,322.59 $    202,323.00
Supplier 3130 $                                6,718.37 $    201,551.00
Supplier 32174 $                                1,138.17 $    198,041.80
Supplier 33343 $                                    564.08 $    193,480.00
Supplier 3436 $                                5,326.86 $    191,766.81
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi donodackal ,

     

    Please try:

    Categories = 
    var _sum=CALCULATE(SUM('Table'[ Total Spend ]),ALLEXCEPT('Table','Table'[Supplier Name]))
    return SWITCH(TRUE(), _sum>1000000 ,"million-dollar club",_sum>=200000 ,"200K to 1M club",_sum>=25000 ,"25k to 200k club","Penny value club")

    Output:

     

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

5 Replies

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Anonymise the data in the PBI file and share the download link.  Ensure your measures are already written in that file.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi donodackal ,

     

    Please try:

    Categories = 
    var _sum=CALCULATE(SUM('Table'[ Total Spend ]),ALLEXCEPT('Table','Table'[Supplier Name]))
    return SWITCH(TRUE(), _sum>1000000 ,"million-dollar club",_sum>=200000 ,"200K to 1M club",_sum>=25000 ,"25k to 200k club","Penny value club")

    Output:

     

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

    • donodackal's avatar
      donodackal
      Helper I

      Hi Evelyn, thank you for your help. When I try this formula, I get all suppliers tagged under the million-dollar club. Btw, my table has more than one row for all suppliers as all of them have many invoices, and the total spend is just the sum of all invoices.