Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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)
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
94 | |
77 | |
63 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |