How do I combine 2 user properties by creating a custom property
You can combine two user properties in Mixpanel by creating a custom property. Here's how to do it:
Creating a Custom Property to Combine User Properties
1. In your Mixpanel report, click the plus button to the right of the search bar
2. Select "User Property" to open the property builder
3. Give your property a name
4. Click into the formula bar to define your formula that combines the two properties
5. Use the appropriate operators to combine your properties:
- +
for addition or string concatenation
- -
for subtraction
- *
for multiplication
- /
for division
- %
for moduloMixpanel Documentation provides details on creating custom properties.
Example Use Cases
You can combine properties in various ways: 1. Mathematical operations: If you have "price" and "quantity" properties, you can multiply them to create a "total price" property.2. Compare different properties: Create a new property that checks if two property values are the same. For example, to check if a user's country has changed since signup:
```LBKSLBKS3. **String concatenation**: You can combine text properties using the `+` operator:
```LBKS .first_name + " " + .last_name
```LBKSLBKSWhen writing your formula, you can press **Ctrl + Space** to see available functions and their descriptions, or press **period (.)** to search for event or user profile properties to add to your formula.LBKSBy default, custom properties are local to the report when you select "Apply." To save the custom property permanently for use in other reports, click "Save" instead.LBKS[Custom Properties Documentation](https://docs.mixpanel.com/docs/features/custom-properties) provides more examples and use cases for combining properties.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
kapa.ai I only want to display on e of the properties and not both combined. This will be in cases where one property has a value and the other one doesn't. If both have a property then it should select the first one
Let me check the knowledge base for you again. One moment! 📚
I understand you want to create a custom property that displays the value of the first property if it exists, and falls back to the second property if the first one doesn't have a value. This is a common use case when dealing with user properties in Mixpanel.You can accomplish this using the if
function combined with the defined
function in Mixpanel's custom property builder. Here's how to do it: 1. Click the plus button to the right of the search bar
2. Select "User Property" to open the property builder
3. Name your property (e.g., "Preferred Property")
4. In the formula bar, use this pattern:
```LBKSLBKSThis formula checks if the first property is defined (has a value). If it is, it will use that value. If not, it will use the second property's value.LBKSYou can also use the `ifs` function for more complex conditions if needed: LBKSLBKS```LBKSifs(
defined(.first_property), .first_property,
defined(.second_property), .second_property,
"No value found"
)LBKS```LBKSLBKSThe `defined` function specifically checks if a property exists on the user profile, returning true if it does and false if it doesn't, which is perfect for your use case.LBKS[Custom Properties Documentation](https://docs.mixpanel.com/docs/features/custom-properties#functions) provides more details on these functions and other options you might find useful.LBKSRemember that custom properties are local to the report by default. If you want to reuse this property in other reports, make sure to click "Save" rather than just "Apply".
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.