Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sudip_J
Helper I
Helper I

Dax function is not working

Hi Teams ,
I want to get the Last Name of customer Name from superstore data .
And I wrote the the following dax code and it is not working 

last_name = RIGHT(orders[Customer_Name],LEN(orders[Customer_Name])-FIND(" ",orders[Customer_Name]))

Please check and give the correct answer.
Note : It would be great if multiple dax query will be provides by your team
Thanks & Regards,
Sudeep Kumar
@all
 
1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Sudip_J ,Try using

 

dax
last_name =
VAR space_position = FIND(" ", orders[Customer_Name], 1, LEN(orders[Customer_Name]))
RETURN RIGHT(orders[Customer_Name], LEN(orders[Customer_Name]) - space_position)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
Sudip_J
Helper I
Helper I

Hi bhanu,
thanks for providing the solution .
I am requesting to can  you please provide another way to get last name ?

bhanu_gautam
Super User
Super User

@Sudip_J ,Try using

 

dax
last_name =
VAR space_position = FIND(" ", orders[Customer_Name], 1, LEN(orders[Customer_Name]))
RETURN RIGHT(orders[Customer_Name], LEN(orders[Customer_Name]) - space_position)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.