Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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 🙂
Hi @Anonymous
Create a measure like
Measure = SWITCH(MAX('4111'[Region]),"we","China",MAX('4111'[Region]))
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.
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.
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?
@Anonymous , sorry about that. I have never used that connection before. Is that why you cannot make a calculated column?
@jbrijalbayup AAS live connection disables many features - including query editor.
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |