2

I am accessing a SSAS DMV through Power Query in Excel via:

let
    Source = AnalysisServices.Database(TabularServerName, TabularDBName, 
             [Query="select * from $SYSTEM.TMSCHEMA_EXPRESSIONS"])
in
    Source

This works great in Power BI, but in Excel, the Expression column is limited to a max of 1024 characters. How do I get Power Query in Excel to give me the entire value? My largest values are around 15000 characters, so still within the stated limits of Power Query that I can find.

If I set up a table with a connection and query behind it, Excel can pull in the entire Expression column, but the downside is the server and database cannot be parameterized and have to be manually changed in the connection. Also I don't remember how to do this manually, so I always have to access the DMV from DAX Studio and export to Excel to set it up!

Update

I did some heavy transformations of this column. I parsed out a value, I used it to merge the file with itself and add a column that I then did a bunch of transformations on, and then used it to replace text within the original problem column. And something in that pulled in the whole value. I tried just doing small parts of this, like adding a column that referenced the problem column, or doing a replace in the problem column, and none of that worked.

So, no, not easy to duplicate or figure out which step fixed it, but for my purposes, I now have what I need.

4
  • 1
    There doesn't seem to be a problem if the long text field comes from an Excel cell. How are you verifying that there is a problem? (Obviously, I cannot pull anything from your server). Commented Dec 28, 2021 at 2:31
  • Thanks for this. I check by adding a column with =LEN(@[Expression]). Nothing is over 1024. I did some transformations on this column and one of them caused Excel to pull in the whole result. I don't have time at the moment to figure out which one fixed it, but I'm off and running!
    – TheRizza
    Commented Dec 28, 2021 at 14:52
  • 1
    Glad you have it working. If you ever figure out the source of the problem, you can post it as an answer. Commented Dec 28, 2021 at 17:40
  • I encountered this issue by concatenating many lines of text sourced from a list. The resulting values are truncated at 1024 characters.
    – CalvinDale
    Commented Aug 21, 2022 at 3:47

2 Answers 2

2

I think it is related to the type of the column your are loading in Excel. I had the same issue and read your answer (with Table.ReplaceValue()). Your solution is hiding the initial point: The function used in the expression you shared for Table.ReplaceValue() is Replacer.ReplaceText() that has the additional specificity to convert a field of type Any to type Text. I tried to just change the type of my field that was truncated when loaded in Excel, from type Any to type Text. Result: the complete values were then loaded in my worksheet.

1
  • Brilliant! Thanks for figuring this out! I confirmed this simple fix works.
    – TheRizza
    Commented Oct 25, 2022 at 15:33
-1

I encountered a similar issue:

I loaded an Excel table containing large texts (around 2500 characters per cell) in power query, made some transformations, and wanted to load the result in another sheet.

All my text cells were truncated at 1024 characters. I made some debugging and noticed that the issue disappear if I untick the "Add this data to the Data Model" in the import date pop-up window.

When unticked, my cells are not truncated anymore and contain the complete text generated by the power query.

Hope this helps.

5
  • Changing the data type of the column from "any" to "text" was my fix, thanks to @Grosbeta's answer above. I did other transformations that caused a similar change, but the type setting was the real fix.
    – TheRizza
    Commented Jun 9, 2023 at 16:13
  • As a new StackOverflow user, please notice that this question already has an accepted answer and that the question is over a year old. Typically, you should only provide another answer if you have something to improve upon the accepted answer, such as it didn't work for you, or a new solution becomes available. In this case, changing the load to the Data Model is a pretty significant change, whereas a type change is a minor change and really something that should be done in the query (bug fix), so the original answer is better.
    – TheRizza
    Commented Jun 9, 2023 at 16:25
  • @TheRizza When reading this answer, it seems as if this shows a good way to deal with 1024 truncation even without conversion from Any to Text. I do not take the time to test this, but I often answer questions that are over a year old and get them upvoted in the end. The accepted answer is one thing and clearly works as you say, but the other answer may still show a way to deal with this without converting anything at all. Have you tested it? Unless somebody has tested this and proven that it does not help, I do not think the downvote is fair. Commented Mar 12 at 17:38
  • I do not dare to upvote this myself now since I cannot test it. If this answer does not help answering the quesion, the answerer might make it a new self-answered question since this seems like a nice trick that should be shared. Commented Mar 12 at 17:38
  • 1
    @questionto42 This really isn't a good solution. Adding to the Data Model is either needed or it's not. It's not a setting you would toggle to make a truncated column load. It's unrelated. A Data Model in Excel is used when you need to load over a million rows, or when you need to do modeling, such as relating separate tables together or writing DAX formulas. If you need one of these things, you load to a Data Model. Otherwise you don't. It is a bad fix for truncation, especially when the accepted answer is the obvious cause of truncation. There is no reason to keep the Text column as Any.
    – TheRizza
    Commented Mar 22 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.