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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

return mutiple rows into one row in a visual

Hi,

 

I have this tablke

 

Transactionitem priceprice
1apple2
1strawberry4
2apple2

 

I want to return a visual with the following info

 

Transactiondetail
1apple 2; straberry 4
2apple 2

 

Is this possible?

 

thanks!

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Try creating a measure as follows:

 

Clubbed value new = CONCATENATEX('Tablename', 'Tablename'[Transaction Item] & " " & 'Tablename'[Price], ", ")
 
Replace Tablename in above expression with your table name and also check if I have used the correct column names.
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can do the following steps in Power Query Editor.

 

1. Merge [item price] column and [price] column.

 

R1.jpg

 

2. Then we need to Group the [Transaction] column.

 

R2.jpg

 

3. We add a custom column to get the result.

 

R3.jpg

 

At last we can delete the [Group] column.

 

R4.jpg

 

The complete M query as follows.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUosKMhJBdJGSrE6EJHikqLE8qTUoqJKIMcELGyEqjAWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Transaction = _t, #"item price" = _t, price = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Transaction", Int64.Type}, {"item price", type text}, {"price", Int64.Type}}),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type", {{"price", type text}}, "en-US"),{"item price", "price"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"D"),
    #"Grouped Rows" = Table.Group(#"Merged Columns", {"Transaction"}, {{"Group", each _, type table [Transaction=nullable number, D=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Text.Combine([Group][D],",")),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Group"})
in
    #"Removed Columns"

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

Anonymous
Not applicable

@v-zhenbw-msft 

Thanks for taking the time to have a look, and you certainly taught me something that will no doubt be useful later, but I needed to do the query in DAX as some of the columns I'm referencing are calculated columns from DAX. 

amitchandak
Super User
Super User

@Anonymous , In case you need aggregation for price

measure =
var _tab = summarize(Table, table[Transaction], Table[item], "_1", sum(Table[price])) //may be max
return
concatenatex(_tab, EE & " " & _1 ,";")

 

Otherwise @Pragati11 solution will work

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Try creating a measure as follows:

 

Clubbed value new = CONCATENATEX('Tablename', 'Tablename'[Transaction Item] & " " & 'Tablename'[Price], ", ")
 
Replace Tablename in above expression with your table name and also check if I have used the correct column names.
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

@Pragati11 

Perfect, thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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