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
Anonymous
Not applicable

Slicer value trimming in dax

Hello All,

 

I have a region slicer having values APAC and USA.

and also I have a department coming from table having values 

India - Hyd

India - Pune

India - Chennai

United States - Newyork

United States - Roseland

 

If region value is APAC then I am showing departments

 

India - Hyd

India - Pune

India - Chennai

 

If region value is USA then I am showing departments

 

United States - Newyork

United States - Roseland

 

My requirement is I need to show only

Hyd

Pune

Chennai

Newyork

Roseland

 

in the department sclier .

 

I need to trim the country names before city when showing

 

Could any one please suggest how to do this

1 ACCEPTED SOLUTION

@Anonymous 

 

This happens because there are names without a dash (-) and the formula throws an error because it cannot find the dash.

I have amended the formula which handles the error message.

 

Column = IFERROR(MID(Sheet1[Name], FIND("-",Sheet1[Name])+2,300), Sheet1[Name])

View solution in original post

3 REPLIES 3
themistoklis
Community Champion
Community Champion

@Anonymous 

 

Create a new colum and add the following DAX formula:

 

New Column = MID(Sheet1[Department], FIND("-",Sheet1[Department])+2,300)
Anonymous
Not applicable

Hi @themistoklis ,

 

I am getting below error.

 

 

Sathvik123_0-1672313989447.png

 

@Anonymous 

 

This happens because there are names without a dash (-) and the formula throws an error because it cannot find the dash.

I have amended the formula which handles the error message.

 

Column = IFERROR(MID(Sheet1[Name], FIND("-",Sheet1[Name])+2,300), Sheet1[Name])

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Kudoed Authors