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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
TaufikMaggangka
Helper II
Helper II

Retrive text from other column in direct query

Hi everyone,

 

I need help about dax in directquery mode. 

 

Basicly, I want to retrive value from this column covidSymptoms to new column, as follow:

CovidSymptoms

fever lossofsmell cough

cough fever

lossofsmell cough

fever lossofsmell

 

I want to give space and separator,  and I hope the new column or costum table should be like this:

CovidSymptoms

fever, loss of smell, cough

cough, fever

lossofsmell, cough

fever, loss of smell

 

Stress about this, I try a lot of different ways such as using text.combines, text.contains with if statement but doesnt work in directquery mode.  Your prompt response will be appriciated.

 

3 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@TaufikMaggangka , You might able to get complex logic work at the column level, You have to create a measure. You can use search or find or containsstring

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

Hi @v-yalanwu-msft , 
Thank you so much. This is give me a clue.
but I have another issues since I also want replace value of "fever" to "Fever", cough to "Cough"(basically I want to first alfabet is Capital) not only loss of smell will be replace.

I try  your sollustion, like this, but doesnt work. your future help will be appriciated.

Measure = var _replace=SUBSTITUTE(MAX([CovidSymptoms])," ",",")
return SUBSTITUTE(_replace,"lossofsmel","loss of smel")
return SUBSTITUTE(_replace,"fever","Fever")
return SUBSTITUTE(_replace,"cough","Cough")

View solution in original post

Hi, @TaufikMaggangka ;

You could change measure as follows:

Measure = var _a=SUBSTITUTE(MAX([CovidSymptoms])," ",",")
var _b=SUBSTITUTE(_a,"lossofsmel","loss of smel")
var _c=SUBSTITUTE(_b,"fever","Fever")
return SUBSTITUTE(_c,"cough","Cough")

vyalanwumsft_0-1626235878806.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
aj1973
Community Champion
Community Champion

Hi @TaufikMaggangka 

It is good to know that there is some limitations in using DQ Mode.

aj1973_0-1626228666430.png

Your model might fall into one of them...

Maybe a Measure with DAX can do the work to see it into a visual, but I don't think that adding a Calculated column is possible.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

v-yalanwu-msft
Community Support
Community Support

Hi, @TaufikMaggangka ;

If you want to achieve it in power query ,you could Right click and use Replace Values, such as:

vyalanwumsft_2-1626085223250.pngvyalanwumsft_1-1626085206689.png

vyalanwumsft_3-1626085251998.png

The final output is shown below:

vyalanwumsft_4-1626085269007.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for trying to help, but this is not working in "Direct Query mode"

Hi, @TaufikMaggangka ;

If your .pbix is  "Direct Query mode" , you should use dax (create a measure )as follows:

Measure = var _replace=SUBSTITUTE(MAX([CovidSymptoms])," ",",")
return SUBSTITUTE(_replace,"lossofsmel","loss of smel")

he final output is shown below:

vyalanwumsft_0-1626227661514.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yalanwu-msft , 
Thank you so much. This is give me a clue.
but I have another issues since I also want replace value of "fever" to "Fever", cough to "Cough"(basically I want to first alfabet is Capital) not only loss of smell will be replace.

I try  your sollustion, like this, but doesnt work. your future help will be appriciated.

Measure = var _replace=SUBSTITUTE(MAX([CovidSymptoms])," ",",")
return SUBSTITUTE(_replace,"lossofsmel","loss of smel")
return SUBSTITUTE(_replace,"fever","Fever")
return SUBSTITUTE(_replace,"cough","Cough")

Hi, @TaufikMaggangka ;

You could change measure as follows:

Measure = var _a=SUBSTITUTE(MAX([CovidSymptoms])," ",",")
var _b=SUBSTITUTE(_a,"lossofsmel","loss of smel")
var _c=SUBSTITUTE(_b,"fever","Fever")
return SUBSTITUTE(_c,"cough","Cough")

vyalanwumsft_0-1626235878806.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much. this is a sollution.

TaufikMaggangka
Helper II
Helper II

  • Thanks @amitchandak  For your clue. Would you like to give me an exampel measure based on my table above.  I try to create measure but not working since this also need to combine the the texts. 
amitchandak
Super User
Super User

@TaufikMaggangka , You might able to get complex logic work at the column level, You have to create a measure. You can use search or find or containsstring

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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