Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi,
I was trying to implement a case statement using switch DAX and the like operator "%" but was not able to do it.
Here is the requirement
if sales_model = 305.5% then 305.5
if sales_model = 306.5% then 306.5
if sales_model = 307.5% then 307.5
if sales_model = D3% then D3
In all other cases take first 3 characters of sales_model
Sample Data:
| Sales Model |
| 305.5E2 |
| 306.5E2 |
| 307.5E2 |
| 912AFAF |
| D3E2 |
Solved! Go to Solution.
Hi,
Does this give you the result you need?
Column = SWITCH (
TRUE (),
SEARCH ( "305", 'Table'[Sales Model],, 0 ) = 1, "305.5",
SEARCH ( "306.5", 'Table'[Sales Model],, 0 ) = 1, "306.5",
SEARCH ( "307.5", 'Table'[Sales Model],, 0 ) = 1, "307.5",
SEARCH ( "D3", 'Table'[Sales Model],, 0 ) = 1, "D3",
LEFT('Table'[Sales Model],3)
)
Hi,
Does this give you the result you need?
Column = SWITCH (
TRUE (),
SEARCH ( "305", 'Table'[Sales Model],, 0 ) = 1, "305.5",
SEARCH ( "306.5", 'Table'[Sales Model],, 0 ) = 1, "306.5",
SEARCH ( "307.5", 'Table'[Sales Model],, 0 ) = 1, "307.5",
SEARCH ( "D3", 'Table'[Sales Model],, 0 ) = 1, "D3",
LEFT('Table'[Sales Model],3)
)
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 42 | |
| 41 | |
| 21 | |
| 21 |
| User | Count |
|---|---|
| 148 | |
| 109 | |
| 63 | |
| 37 | |
| 36 |