cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Need to Create New Column using Combination of multiple row with same Code

Hello Users,

I need to create one custom column using Power Query / DAX

as per below images, i have one column conatins code against each item Name

in result i  need one column that conatins only single line for each item (IF both item having same code)

please find below images for refrence. i need output as per shown in output snapshot.

1 ACCEPTED SOLUTION
Super User

Hi @Dhrutivyasa-070 you can create NEW table in Power BI as following:

VALUES ( Sheet7[Code] ),
"Qty", [M_Qty],
"Item (Combo)",
CONCATENATEX (
CALCULATETABLE ( VALUES ( Sheet7[Item] ) ),
Sheet7[Item],
" + ",
Sheet7[Item],
ASC
)
)

TableCombo - is name of NEW table
M_Qty = SUM(Sheet7[Qty]) - this is measure which you should create so table above is working

Original reference to this solution: https://dax.guide/concatenatex/
Output should be like on picture below
I hope this help

Proud to be a Super User!

4 REPLIES 4
Helper V

cobovalues =

CALCULATE(DISTINCT(code),CONCATENATE([item],"+",[item]),SUM(Qty),IF(COUNTROWS(DISTINCT(code),"Combo","-")))

Super User

Hi @Dhrutivyasa-070 you can create NEW table in Power BI as following:

VALUES ( Sheet7[Code] ),
"Qty", [M_Qty],
"Item (Combo)",
CONCATENATEX (
CALCULATETABLE ( VALUES ( Sheet7[Item] ) ),
Sheet7[Item],
" + ",
Sheet7[Item],
ASC
)
)

TableCombo - is name of NEW table
M_Qty = SUM(Sheet7[Qty]) - this is measure which you should create so table above is working

Original reference to this solution: https://dax.guide/concatenatex/
Output should be like on picture below
I hope this help

Proud to be a Super User!

Helper I

Thanks for the solution, it worked for me!

Super User

Item (Combo) =
CONCATENATEX ( VALUES ( 'Table'[Item] ), 'Table'[Item], ", " )

Total Qty =
SUM ( 'Table'[Qty] )

Remark =
IF ( COUNTROWS ( VALUES ( 'Table'[Item] ) ) > 1, "Combo", "-" )

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors