Concatenate rows per group in RDLC report - visual-studio

Is it possible to concatenate rows into single one? Attached image shows what is required. First table is what I get and second table is what I need. It is the same as SUM function but just need to concatenate strings instead of sum calculation.
I am unable to change datasource.

You can use the & operator.
=Exp1 & ", " & Exp2 & ", " & Exp3
This concatenates the three values with dots between them.

Related

Modify query function so it can work as an arrayformula in Google Sheets

How do I modify this equation so I can use it with an array function instead of dragging it down.
SUBSTITUTE(JOIN(", ", UNIQUE(QUERY(A:D,"SELECT B WHERE C = '"&G2&"'"))), ", , ", "")
Explanation of the equation:
Have a function is used to extract and concatenate unique values from column B of a sheet named A:D, where the values in column C match a specific criteria. The function is made up of several parts:
It uses the QUERY function to extract all values from column B of sheet A:D where the values in column C match the specific criteria in G.
UNIQUE removes any duplicate values from previous step.
JOIN to concatenate into a single string separated by a comma to returns a string of unique values that match the criteria
SUBSTITUTE to replace occurrences of ", , " with an empty string.
can you try:
=BYROW(G2:G,LAMBDA(gx,IF(gx="",,TEXTJOIN(", ",1,IFNA(UNIQUE(FILTER(B:B,C:C=gx)))))))

SSRS [Sort Alphanumerically]: How to sort a specific column in a report to be [A-Z] & [ASC]

I have a field set that contains bill numbers and I want to sort them first alphabetically then numerically.
For instance I have a column "Bills" that has the following sequence of bills.
- HB200
- SB60
- HB67
Desired outcome is below
- HB67
- HB200
- SB60
How can I use sorting in SSRS Group Properties to have the field sort from [A-Z] & [1 - 1000....]
This should be doable by adding just 2 separate Sort options in the group properties. To test this, I created a simple dataset using your examples.
CREATE TABLE #temp (Bills VARCHAR(20))
INSERT INTO #temp(Bills)
VALUES ('HB200'),('SB60'),('HB67')
SELECT * FROM #temp
Next, I added a matrix with a single row and a single column for my Bills field with a row group.
In the group properties, my sorting options are set up like this:
So to get this working, my theory was that you needed to isolate the numeric characters from the non-numeric characters and use each in their own sort option. To do this, I used the relatively unknown Regex Replace function in SSRS.
This expression gets only the non-numeric characters and is used in the top sorting option:
=System.Text.RegularExpressions.Regex.Replace(Fields!Bills.Value, "[0-9]", "")
While this expression isolates the numeric characters:
=System.Text.RegularExpressions.Regex.Replace(Fields!Bills.Value, "[^0-9]", "")
With these sorting options, my results match what you expect to happen.
In the sort expression for your tablix/table which is displaying the dataset, set the sort to something like:
=IIF(Fields!Bills.Value = "HB67", 1, IIF(Fields!Bills.Value = "HB200", 2, IIF(Fields!Bills.Value = "SB600", 3, 4)))
Then when you sort A-Z, it'll sort by the number given to it in the sort expression.
This is only a solution if you don't have hundreds of values, as this can become quite tedious to create if there's hundreds of possible conditions.

Excel Power Query: How to Combine All List Items into Single Row

I have a query to the Cognitive text keyphase API from Microsoft from '16 Excel Power Query - getting keywords from tweets. Works fine.
However, the JSON doc that's returned per query is converted by Power Query into a list of ~1-5 rows.
In the case of the pic, I want all responses returned to be in one cell/row, regardless of the number of items returned.
Here is my full M query (you need to put your own key in) if you're interested.
let
TweetCognitive = (TweetID as text, TweetText as text) =>
let
JsonRecords = Text.FromBinary(Json.FromValue([id=TweetID, text=TweetText])),
JsonRequest = "{""documents"": [" & JsonRecords & "]}",
JsonContent = Text.ToBinary(JsonRequest, TextEncoding.Ascii),
Response =
Web.Contents("https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/keyPhrases?",
[
Headers = [#"Ocp-Apim-Subscription-Key"="yourkeyhere",
#"Content-Type"="application/json", Accept="application/json"],
Content=JsonContent
]),
JsonResponse = Json.Document(Response,1252)
in
JsonResponse
in
TweetCognitive
You can use List.Accumulate to turn a list of values into a single value. For example, this would combine the values in the list into a single text value with ". " separating each row's value:
List.Accumulate(JsonResponse, "", (state, current) => state & current & ". ")
This would generate "monday frank love happiness today. nice good kind. tomorrow. " in your example. If you want to get rid of the trailing space, you can surround the List.Accumulate expression with Text.Trim.
The basic function to concatenate elements in a list is Text.Combine. For instance:
Text.Combine(JsonResponse, " ")
This avoids the extra delimeter at the end you get with List.Accumulate. Note also List.Combine is for creating a longer combined list from shorter lists, and the similar naming there may cause confusion.

How to avoid first instance of data while string concatenation

I am concatenation hlinks obtained from word do
data = data & "," & Vbcr & hlnk.Address & ":" & hlnk.TextToDisplay
Here ',' is separator.
Now I get every time data starting with ',' (obviously)
I then use
data = Right(data,Len(data)-1)
But I doubted my method of string concatenation.
Am I using Right method of string concatenation in first place?
I have seen ASP classic - how do I join an array of strings / join / implode do not work but I don't think that is my case. I am not joining array but creating one.
The canonical way to avoid leading (or trailing) list separators is to collect the items you want to concatenate in an array, then join that array. That's probably why #Filburt considered your question a (borderline) duplicate. If you don't know the number of items beforehand you'd dynamically resize the array:
ReDim a(-1)
For Each hlnk In ...
ReDim Preserve a(UBound(a)+1)
a(UBound(a)) = hlnk.Address & ":" & hlnk.TextToDisplay
Next
Once the array is filled you simply join the elements:
data = Join(a, "," & vbCr)
Otherwise you need to either handle the first (or last) element differently from the rest:
If IsEmpty(data) Then
data = hlnk.Address & ":" & hlnk.TextToDisplay
Else
data = data & "," & vbCr & hlnk.Address & ":" & hlnk.TextToDisplay
End If
or remove the leading (trailing) separator after you finished constructing the string:
data = Mid(data, 3)

Qlikview sorting date dimension formatted as text

Can someone help me sort a date dimension in a QlikView pivot? The dimension is set as follows:
Week(DateField) & chr(13) & '' & Weekstart(DateField,0,-1)
An example of value:
"43
10/19/2014"
Another example:
"1
12/28/2014"
chr(13) returns a new line so that the week number and the day with which the week starts are placed on two different rows.
I have tried putting this expression in a listbox to play with it and to try different variants for sorting. Below are my attempts:
Sort by expression: =DateField
Sort by expression: =LEFT(DAY(DateField) + NUM(MONTH(DateField))*100 + YEAR(DateField)*10000,100)
Sort by expression: =LEFT(DateField,2) (not ok anyway as it would not work if multiple years were loaded)
etc
but nothing seems to work
Any help is much appreciated.
Like you said, the issue is that when you create that concatenation, it becomes a string and it's sorted as such.
Luckly, QlikView has the Dual function that can help you in this case, defining the dimension as a calculated dimension with the following expression :
=Dual(Week(DateField) & chr(13) & '' & Weekstart(DateField,0,-1), Weekstart(DateField,0,-1))
The syntax of Dual is Dual(Text, Numeric Value), meaning that it will create an object that will be represented by the value Text but sorted by the Numeric Value.
Check QlikView help page for this function for further information.
This should work:
=Weekstart(DataField,0,-1)

Resources