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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

DAX measure change string

Hello, 

I am trying to create a DAX measure (cannot be calculated column - I am using live connection to AAS) to change string values in a column.  So, for example, I have a column with abbreviations like "CHN" that the users wants to instead see "China" for.  I have written switch statements using Switch/true in the past for the same purpose but for some reason I cannot get it to work now.  Please help thank you 🙂

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create a measure like

Measure = SWITCH(MAX('4111'[Region]),"we","China",MAX('4111'[Region]))

6.png

 

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you @v-juanli-msft.  I actually did end up writing a similar switch statement - I wrote mine a bit differently using hasonevalue and values, but same idea.  

 

Problem is - and I think this applies to both your measure and mine - it's dependent on context so it really only works if I include it with the column that I am changing the name from.   This isn't very helpful if I want to include it in on the x axis or legend -  though I believe that is a limitation of measures in general.  Ultimately I think this is one of those cases that ideally is done in a column instead of a measure.  In the meantime I have given the user a "legend" which is a table that shows original column and column with the desired corresponding text.  

 

But if you know of a way to make the measure perform like a column I'd love to hear it 🙂 I am running into a lot of walls with AAS live connection.

jbrijalba
Helper I
Helper I

I have ran into the same issue using SWITCH and IF in a measure. Have you tried going to Edit Queries and using the Replace Values function?

 Replace.PNG

Anonymous
Not applicable

@jbrijalbacannot edit queries with AAS live connection, unfortunately.

@Anonymous , sorry about that. I have never used that connection before. Is that why you cannot make a calculated column?

Anonymous
Not applicable

@jbrijalbayup AAS live connection disables many features - including query editor.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.