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 am trying to extract the left side of the UK Postcode in PowerBI before the space, as per the examploe below of what the output would be in "Area".
Post Code | Area |
G1 0LT | G1 |
G2 4PP | G2 |
EH1 1SU | EH1 |
EH7 4GB | EH7 |
G82 4AS | G82 |
EH22 6BD | EH22 |
In Excel, I've done this before and using cell A2 as a location reference of the postcode, it is this:
LEFT(A2,FIND(" ",A2)-1) to give outputs such as above.
I've tried to do this in PowerBI (N.B. I have 2 postcode columns to merge, hence the IF statement), but with no luck. Can someone point and help me in the right direction:
Solved! Go to Solution.
@RD_PowerBI24 lets' try this:
LEFT (
'Table'[All Postcodes],
FIND ( " ", 'Table'[All Postcodes], 1, LEN ( 'Table'[All Postcodes] ) + 1 ) - 1
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@RD_PowerBI24 lets' try this:
LEFT (
'Table'[All Postcodes],
FIND ( " ", 'Table'[All Postcodes], 1, LEN ( 'Table'[All Postcodes] ) + 1 ) - 1
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
That worked thank you!
@RD_PowerBI24 I would recommend creating a sample pbix file with these two columns and sending it over. I think I'm missing something here.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi Parry2k, I don't have the option to do so unfortunately. I'm hoping my example in the first post itself should explain that I just want the left side of a postcode when a gap/space is found inthe postcode.
I use
@RD_PowerBI24 doesn't make any sense? Can you try with ISBLANK () and see if you get the value? Not sure what it is complaining about, assuming Postcode and PostCode 2 columns are of type text and are in the table.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi Parry2k,
The if statement is picking up a postcode from Postcode 2, if POSTCODE is blank/empty, otherwise picks up a postcode from POSTCODE column. I have 2 sales data sources here, hence the use of
@RD_PowerBI24 are you getting errors or incorrect results? Can you make sure All_Sales[POSTCODE] has null (blank) value or is it a space?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi Parry2k, I get Error when running the FIND function:
Yes my postcodes do have a space as per the column below:
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 |
---|---|
97 | |
95 | |
80 | |
77 | |
66 |
User | Count |
---|---|
130 | |
106 | |
105 | |
86 | |
72 |