Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I am currently trying to create a custom column in Power BI to classify email campaigns based on certain criteria. The column is called "CRITERIO" and I am using the SWITCH function to assign values to each campaign based on its name and the number of emails sent.
Here is the formula I am using:
The formula is supposed to assign values of "AURIS" or "TEST" to campaigns whose names contain those words, and "TOP 5", "TOP 6-10", or "TOP 11-15" to campaigns whose email volumes rank within those thresholds. All other campaigns should be assigned a value of "OTHER".
Here's and data's example:
RECIPIENT_ID | EVENT_TYPE | NOMBRE | |
607227625501 | Sent | LPR | xxxxxxx@gmail.com |
579440932400 | Open | [AURIS] SIN CONTACTO API | yyyyyy@icloud.com |
579440932952 | Sent | [TEST] LISTO PARA RETIRO API | zzzzzzz@hotmail.com |
579440957813 | Sent | ENCUESTA | aaaaaaa@email.com |
618127727620 | Sent | POLL | bbbbb@email.com |
565900248891 | Sent | WELCOME | ccccccc@email.com |
However, I am running into a few issues. First, the formula is not correctly filtering the "TOP 5" campaigns, and is instead assigning that value to all campaigns that are not "AURIS" or "TEST". Second, occasionally the formula is creating a circular dependency that prevents me from using the "COUNT" function instead "DISTINCTCOUNT".
I have tried a few different variations of the formula, including using COUNTROWS instead of DISTINCTCOUNT, and using a different column as the first argument of the RANKX function, but I have not been able to resolve the issues.
Any help or suggestions would be greatly appreciated. Thank you!
Please provide sample data that covers all your scenarios.
I just added a sample to use!
Please provide sample data that covers your issue or question completely.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |