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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RobertRR
Frequent Visitor

How to display objects in a grouping

I would like to know if there is any way to display the query values for an external data source in object format and not in plain text with the concatenated values. To do this, I need to create a grouping in a matrix displaying the grids horizontally.

Here is an example grid displaying each record returned from the query, one grid next to the other:

RobertRR_0-1706113094027.png

Now I am using the Join and Lookup Set function to fetch the query data from another dataset. I'm using the exact same grouping function on the expression in the text field you can see selected in the report:

RobertRR_1-1706113367105.png

The result is this, the grouping did not result in anything, just the expression in the text field that resulted in the concatenated values. But I don't want that, I want to create new objects for each record found. Does anyone have any ideas on how to do this, would custom code be required? Grids displaying correctly on first print is only possible because they are in the same dataset.

RobertRR_2-1706113492429.png

 

3 REPLIES 3
Anonymous
Not applicable

Hi @RobertRR ,

You want to display the query value of the external data source in object format, not in plain text with the join value. This may require custom code.

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I understand, I expected that. However, I have no idea how to do this with custom code, I searched the Microsoft documentation and didn't find anything related. I would be grateful if you could help me find a code example.

Anonymous
Not applicable

Hi @RobertRR ,

Here is the sample:

Public Function GetUsers(ByVal param As Integer) As String
    Dim sqlCon As New System.Data.SqlClient.SqlConnection
    Dim cmd As New System.Data.SqlClient.SqlCommand
    Dim dRet As String
    Dim sCmdText As String

    sqlCon.ConnectionString = "data source=MYSERVER;initial catalog=MYDB;Integrated Security=true"

    cmd = New System.Data.SqlClient.SqlCommand
    sCmdText = "SELECT dbo.udf_MyFunction(" 
    'cmd.CommandType = CommandType.Text
    cmd.Connection = sqlCon
    cmd.CommandTimeout = 0

    sCmdText = sCmdText & param
    sCmdText = sCmdText & ")"

    cmd.CommandText = sCmdText
    If sqlCon.State <> System.Data.ConnectionState.Open Then
    sqlCon.Open()
    End If
    dRet = cmd.ExecuteScalar() & ""     
    sqlCon.Close()

    Return dRet

End Function

Below is the official link will help you:

Custom code and assembly references in expressions in a paginated report in Report Designer - Micros...

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.