LEFT

LEFT

How to Use the Power BI DAX function LEFT

Syntax

The syntax for the LEFT function is as follows:


LEFT(text, num_chars)


Where `text` is the string you want to extract from, and `num_chars` is the number of characters you want to extract.

Examples

Example 1: Extracting the First Name from a Full Name

Let's say you have a column in your data set that contains the full names of your customers, and you want to extract their first names. You can use the LEFT function to do this. Here is an example of how to do it:


=LEFT([Full Name], FIND(” “, [Full Name])-1)


In this example, we are using the FIND function to locate the first space in the full name and subtracting one to get the number of characters to extract. This will give us the first name of each customer.

Example 2: Extracting the First Two Characters of a Code

Let's say you have a column in your data set that contains codes for different products, and you want to extract the first two characters of each code. You can use the LEFT function to do this. Here is an example of how to do it:


=LEFT([Product Code], 2)


In this example, we are simply extracting the first two characters of each product code.

The LEFT function in Power BI is a powerful tool that can be used in many different scenarios. Whether you need to extract a specific subset of data or simply want to clean up your data set, the LEFT function can help. By understanding the syntax and examples provided in this article, you should be able to use the LEFT function in your own Power BI projects.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

Subject

Your Name (required)

Company/Organisation

Email (required)

Telephone

Training Course(s)

Your Message

Upload Example Document(s) (Zip multiple files)

Copyright, G Com Solutions Ltd, 2024.
Tower Bridge Business Centre, 46-48 East Smithfield, London E1W 1AW
0800 998 9248   |   9:00 a.m. till 5:30 p.m.

Connect With Me: