cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kendraakaay Regular Visitor
Regular Visitor

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
jbrijalba Frequent Visitor
Frequent Visitor

Re: DAX measure change string

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

Kendraakaay Regular Visitor
Regular Visitor

Re: DAX measure change string

@jbrijalbacannot edit queries with AAS live connection, unfortunately.

jbrijalba Frequent Visitor
Frequent Visitor

Re: DAX measure change string

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

Kendraakaay Regular Visitor
Regular Visitor

Re: DAX measure change string

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

Community Support Team
Community Support Team

Re: DAX measure change string

Hi @Kendraakaay 

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.

Kendraakaay Regular Visitor
Regular Visitor

Re: DAX measure change string

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.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 335 members 3,357 guests
Please welcome our newest community members: