Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hi All
Can some one share with me how to write this expression ?
My PBI file :-
https://www.dropbox.com/s/4ysqturttdwcdf4/PB_TDS_V080%20RECODE%20BRAND%20TO%20PROJECT.pbix?dl=0
Solved! Go to Solution.
Hi @Paulyeo11
Try this SWITCH statement
Column 2 = SWITCH(
TRUE(),
LEN([BRAND_5]) = 0 && LEN([PRO_CLASS]) = 0 , "No Brand",
LEN([BRAND_5]) = 0 && SEARCH(" ", SALES[PRO_CLASS], 1, BLANK()) > 0 , LEFT([PRO_CLASS], SEARCH(" ", SALES[PRO_CLASS], 1, BLANK())),
LEN([BRAND_5]) = 0 && LEN([PRO_CLASS]) > 0 , [PRO_CLASS],
[BRAND_5]
)
Phil
Proud to be a Super User!
Hi @Paulyeo11
Try this SWITCH statement
Column 2 = SWITCH(
TRUE(),
LEN([BRAND_5]) = 0 && LEN([PRO_CLASS]) = 0 , "No Brand",
LEN([BRAND_5]) = 0 && SEARCH(" ", SALES[PRO_CLASS], 1, BLANK()) > 0 , LEFT([PRO_CLASS], SEARCH(" ", SALES[PRO_CLASS], 1, BLANK())),
LEN([BRAND_5]) = 0 && LEN([PRO_CLASS]) > 0 , [PRO_CLASS],
[BRAND_5]
)
Phil
Proud to be a Super User!
Hi Phil
Can you pls help me modify the script , so that it only display 3 Core Brand ?
Hi Phil
Thank you very much for your help. it work wonderfull.
Hi @Paulyeo11
This will display any single word like MSA from the PRO_CLASS column
Column = IF(LEN([BRAND_5]) = 0 , IF( SEARCH(" ", SALES[PRO_CLASS], 1, BLANK()) = 0 , [PRO_CLASS] , LEFT([PRO_CLASS], SEARCH(" ", SALES[PRO_CLASS], 1, BLANK()))) , [BRAND_5] )
Phil
Proud to be a Super User!
Hi Phil
Many thank it work , pls help me make it display No Brand when PRO_CLASS is empty.
Hi @Paulyeo11
This works,
Column = IF(LEN([BRAND_5]) = 0 , LEFT([PRO_CLASS], SEARCH(" ", SALES[PRO_CLASS], 1, BLANK())), [BRAND_5] )
There's a 'feature' with SEARCH (and FIND) that you have to specify the optional 3rd and 4th parameters or it throws an error in certain cases.
Phil
Proud to be a Super User!
Hi Phil
Yes it work , But when PRO_CLASS only have MSA , may i know how to pick up this word ?
Hi @Paulyeo11
This should work to return the first word from the PRO_CLASS column. Create a new column and enter this formula
Column = IF(ISBLANK([BRAND_5]) , LEFT([PRO_CLASS], SEARCH(" " , [PRO_CLASS])), [BRAND_5] )
Phil
Proud to be a Super User!
Hi Phil, Still same as Amit result :-
Hi Amit
I have try but when No Brand , it does not take PRO_CLASS field first charater.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
102 | |
68 | |
45 | |
37 | |
36 |