--- title: "Customer Categorization with Case Expression Formula field" slug: "customer-categorization-with-case-expression-formula-field" updated: 2026-11-23T12:31:41Z published: 2026-11-23T12:31:41Z canonical: "support.gainsight.com/customer-categorization-with-case-expression-formula-field" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.gainsight.com/llms.txt > Use this file to discover all available pages before exploring further. # Customer Categorization with Case Expression Formula field This article explains how to use the Case expression formula field in Rules engine. Gainsight recommends that you refer to the [*Case Expression*](/v1/docs/formula-fields-in-rules-engine#case-expression) section of the Formula Fields in Rules Engine article and then proceed with this article. ## Overview The Case Expression feature in Rules Engine allows you to categorize your data based on various parameters. This feature is reminiscent of the [*Switch Statement*](https://www.geeksforgeeks.org/switch-statement-in-java/) used in various programming languages. This article explains a specific use case in which you can use the Case expression feature to categorize your customers based on the revenue generated by them. Consider a situation in which you wish to categorize all your customers into Platinum, Gold, Silver and Bronze, based on the revenue generated by the customers. You can easily accomplish this task with the Case Expression. You can create four cases in Case Expression. The requirements for a Customer to be categorized as Platinum can be mentioned in the first case, Gold requirements can be specified in the second case and so on. ![M1.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M1.png?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=faaFsl%2BgR7vFbNdeFgl6KwWJcZhQ7rsI0ZUPtScemTk%3D) ## Assumptions - The Company object has a custom field called Account Name. This field stores all the names of the customers. - If the MRR of a customer is greater than 4000, the customer is considered to be a Platinum customer. - If the MRR of a customer is between 3000 and 3999, the customer is considered to be a Gold customer. - If the MRR of a customer is between 2000 and 2999, the customer is considered to be a Silver customer. - If the MRR of a customer is less than 2000, the customer is considered to be a Bronze customer. ## Create Dataset To Create Dataset: 1. Navigate to **Administration > Rules Engine**. 2. Click **Create Rule**. The New Rule window is displayed. 3. Enter the following details. 1. Enter a name in the **Rule Name** field. 2. *(Optional)* Select a folder for the rule. 3. (Optional) Enter a description for the rule. 4. Click **NEXT**. ![M2.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M2.png?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=0eeMbQK%2FMbKzuq6FO936TOC5DyZYermfc8nZfrTHmhM%3D) 5. Click **DATASET** 6. Select **Company** as the source object. ![M3.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M3.png?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=3LXoxDQiYZKlZJOk0xcMu%2BP8LAxPT360ABLKqeKfY5k%3D) 7. Drag and drop **Account Name** and **MRR** fields to the Show section. 8. Click **Save**. 9. Click <-. ![M4.GIF](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M4.GIF?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=NT%2FroRrX29bCW4L7hUKdvGo47%2BDMw3Iu%2F7AoGDvPOpo%3D) ## **Create Transformation Task** To Create Transformation Task: 1. Click **+ TASK** and select **Transformation**. 2. Enter a name for the task in the **Task Name** field. 3. Select the Source Dataset (here it is *Fetch from Company*). ![M5.GIF](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M5.GIF?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=ZqanPBpSK5vktzsCIWGDmr48PtFotMaZpN98wMuDdgE%3D) 4. Drag and drop **Account Name** to the Show section. 5. Drag and drop **Case Expression** to the Show section. ![M6.GIF](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M6.GIF?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=VEYcufuGG%2BsVwMBK2cP9GslxW96YYZDF5BLoiTRM1Xc%3D) ## Configure Case Expression To Configure Case Expression: 1. Enter **Customer Type** as the Output Field Label. 2. Select **String** as the **Output Data Type**. 3. Select: This is the criteria for Platinum customers. If the MRR > 4000, the customer is considered to be Platinum. ![1.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/1(14).png?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=MU8zmpRuzdAL4mZg8lXUXgh3ihDJHF0c5JKI4FTkwYA%3D) 1. **MRR** field 2. **>=** operator 3. **Value** 4. **4000** 4. Select **Custom** in the **Then** field and enter **Platinum Customer.** This is the Case Action which writes the value **Platinum customer** in output column **Customer Type**.![M8.gif](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M8.gif?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=to6udRwSFvPhhKZRc91w3mjyb3no021I4%2Bm%2BIjmP8%2FI%3D) 5. Click **+ Case** 6. Select: 1. **MRR** field 2. **>=** operator 3. **Value** 4. **3000** 7. Click **+ Criteria**. 8. Select: This criteria is for Gold Customers. The value MRR must be between 3000 and 3999. ![M9.gif](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M9.gif?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=j0VV2TVf8qd0WNWwcbjNhekobcWkNckJBaGn8RJ5B0c%3D) 1. **MRR** field 2. **<** operator 3. **Value** 4. **3999** 9. Select **Custom** in the **Then** field and enter **Gold customer.** ![M10.gif](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M10.gif?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=9MU%2Bumdzux7KWOzbCEnSMW9lnxOv0ADoXQW88XgV004%3D) 10. Similarly, create another two cases for Silver and Bronze customers with MRR between 2000-2999 and MRR less than 1999, respectively. ![M11.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M11.png?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=1wY1MZghfRoH17sYY7D7oxiah7qHr59sUxb%2FuhmMOcU%3D) 11. Select **Custom** and type **Invalid Customer** in the **DEFAULT** field. 12. Click **SAVE**. ![M12.gif](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M12.gif?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=qWLTiDvbbCSZrrKhEbd%2B%2Fa%2B6ZbTLDiaYckw1sfmRr%2BU%3D) When you execute this rule, the following output is generated. ![M13.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/M13.png?sv=2026-02-06&spr=https&st=2026-11-24T17%3A01%3A39Z&se=2026-11-24T18%3A01%3A39Z&sr=b&sp=r&sig=UIbJsx58i8dUZB%2F3bBT3%2FwF8%2BkUTHWV%2FVQ7ctsqC%2Foc%3D)