Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello all,
Please see the Scrrenshot. I have a column named "Hashtag". Each cell is automatically getting data from sharepoint. the user has in sharepoint the option to tick Checkboxes (allow multiple selections). I now need the cells to be text cells. How can I transform the List within each cell into text (hashtags devided with "," ?)
Thank you so much for your help!
Use Text.Combine:
https://msdn.microsoft.com/en-us/library/mt253358.aspx
Hello. I already had that idea. Can you specify a little bit more and maybe write a lign of code that I could use? I am not a coder! Also, where exactly should I insert the function?
You should be able to put it whereever in your query, open up Advanced Editor and add a line. Here is an example function I wrote that you can take a look at:
let fnCombine = () => let values = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" }, Result = Text.Combine(values,",") in Result in fnCombine
Also, here it is as a generic function that you should be able to use. Just add a Blank Query, paste in the code below, save function. Add Column -> Invoke Custom Function and send it your column that is a list as its parameter.
let fnCombine = (values as list) => let Result = Text.Combine(values,",") in Result in fnCombine
Hello,
Thank you for your detailed explaination. I tried what you told me and used the generic function. Unfortunately it didn't work. Here is the code of the query I hava so far. Can I add a line within this query, that transforms the list within the cells into text?Probably before the changed type line, since after that line, there is not written List within the cells of the columns "hashtag" and "category" anymore, but Error. I would prefer not to open up a new query.
let
Source = SharePoint.Tables("https://hilti.sharepoint.com/sites/de001101", [ApiVersion = 15]),
#"3860ef3e-aef8-4ee7-bc63-1c29b67a7e9f" = Source{[Id="3860ef3e-aef8-4ee7-bc63-1c29b67a7e9f"]}[Items],
#"Changed Type" = Table.TransformColumnTypes(Custom1,{{"Idea Title", type text}, {"Date of Idea Entry", type date}, {"Submitter", type text}, {"Hashtag", type text}, {"Mealsize", type text}, {"Idea Status", type text}, {"Ranking of Idea", type text}, {"Meal Size", type text}, {"Implementierung", type text}, {"Category", type text}, {"Hashtag", type text}}),
#"Removed Blank Rows" = Table.SelectRows(#"Changed Type", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))
in
#"Removed Blank Rows"
Also, I will create two new queries afterwards, to reorganize the columns "hashtag" and "category". One example for hashtag:
let Source = IdeaList, #"Select Columns" = Table.SelectColumns(Source,{"Idea Title", "Hashtag"}), #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Select Columns", {{"Hashtag", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Hashtag"), #"Trimmed Text" = Table.TransformColumns(#"Split Column by Delimiter",{{"Hashtag", Text.Trim, type text}}) in #"Trimmed Text"
I did not write that code...
@ottiphi,
Add a "Extract values" step before change type and check if you get expected result.
#"Extracted Values" = Table.TransformColumns(#"3860ef3e-aef8-4ee7-bc63-1c29b67a7e9f", {"Hashtag", each Text.Combine(List.Transform(_, Text.From), ","), type text})
There is an example for your reference.
Regards,
Lydia
Hi Lydia,
the code seems to work perfectly fine! Everthything just looks like it should. Thank you so much vor you held! When I apply the query changes though, I get the message as shown below ("the 'ID 2' column does not exist in the rowset"). That is true! But I just pulled the data from a SharePoint-List and did not modify the amount of columns. Also I don't have the description "ID 2" for anything in my code. Can you help me here?
Best regards,
Philipp
@ottiphi,
In your scenario, delete the extract value step from code in Advanced Editor, then check if you can apply query changes successfully.
If there is no issue, extract values directly from UI following the guide in the screenshots below.
Regards,
Lydia
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
70 | |
63 | |
40 | |
28 | |
16 |