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

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

Reply
sujesth
New Member

Combining two rows with same ID, but selecting only one

Hi,

 

I'm having some trouble combining rows for products that have the same ID. What I am trying to do is have just one line item for a product that appears more than once in my table.

 

Current Table Sample

REFYEARPRODUCTCOSTPERSON
A12023Pears $       1.50Bob
B22023Apples $       1.30Bob
B22023Red Apples $       1.30Jane
 2023Oranges $       1.00Jane
C262024Green Lime $       1.10Bob
C262024Lime $       1.10Lisa

- not all the items have a REF

- the product name may be a little different, but the REF and COST are really what I need to focus on. 

 

Desired Table Sample

REFYEARPRODUCTCOSTPERSON
A12023Pears $       1.50Bob
B22023Red Apples $       1.30Jane
 2023Oranges $       1.00Jane
C262024Lime $       1.10Lisa

 

I'm not able to essentially "eliminate" a row. Calculated columns don't give me what I need and I've been unsuccessful with measures.  This is the latest measure I used, but this just repeats the cost value. Not sure what I'm doing wrong here. 

 

Product_Cost = VAR COST = ADDCOLUMNS('MyTable', "ActualCost", CALCULATE(MAX('MyTable'[Cost]), GROUPBY('MyTable','MyTable'[Ref]))) RETURN MAXX(COST, IF('MyTable'[Cost] = [ActualCost], 'MyTable'[Cost],0))

 

Any help will be very much appreciated! Thank you!

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

you can not create a new table, but simply apply a conditional filter to your table using two measures
Sample PBIX file attached
https://1drv.ms/u/s!AiUZ0Ws7G26RhkAP-DuxcAVJ0sSp?e=OHmJ59
1.png2.png3.png

View solution in original post

3 REPLIES 3
sujesth
New Member

Thank you @Ahmedx and @Arul! The solution using two measures suggested by @Ahmedx worked better for my purposes. Thank you!

Ahmedx
Super User
Super User

you can not create a new table, but simply apply a conditional filter to your table using two measures
Sample PBIX file attached
https://1drv.ms/u/s!AiUZ0Ws7G26RhkAP-DuxcAVJ0sSp?e=OHmJ59
1.png2.png3.png

Arul
Super User
Super User

@sujesth ,

Try this as a calculated table,

 

Test Table = 
VAR _tempTable = 
SUMMARIZE(
    'Table',
    'Table'[REF],
    "Year",MAX('Table'[YEAR]),
    "Product",MAX('Table'[PRODUCT]),
    "Cost",MAX('Table'[COST]),
    "Name",MAX('Table'[PERSON])
    )
RETURN _tempTable

Arul_0-1678946237117.png

 

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors