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
Anonymous
Not applicable

Combine rows if they meet certain Critiria

Im trying to match out entries in one of our GL accounts, and need to add a reciving number for each.

THerefore I need to clean the receiving data.

PO nopo lineRecvng noitemtrans date Report qty
MT194690011515001MP-5H10151920
MT194690012327001PT-809101910
MT194690013515002MC-3A HONDA10151910
MT194690013515002MC-3A HONDA10151910
MT1946900151308001AP-210312201
MT1946900151308002AP-210312201
MT1946900151308003AP-210312201
MT1946900151308004AP-210312201
MT1946900151308005AP-210312201
MT1946900151308006AP-210312201
MT1946900151308007AP-210312201
MT1946900151308008AP-210312201
MT1946900151308009AP-210312201
MT1946900151308010AP-210312201
MT1946900115746003ST541A021121191
MT1946900115746004ST541A021121191
MT1946900115912001ST541A021218191
MT1946900115912002ST541A021218191
MT1946900115912003ST541A021218191
MT19490001172001WIDE DIE07161952
MT1950000113522001RB 2214 TM0518211
MT195790011795001AP-31204191
MT195790011795002AP-31204191
MT195880011651001647521106191

To do so I need the following done.:

 

if the PO number, line number, and transaction date match on multiple rows AND the report qty is 1 for each row

Then excess rows need to be summed into the the row with the lowest reciving number and excess rows deleted.

 

These are serielaized items, and they get individual receiving numbers,

but are all received at the same time. So all we need is the total for the PO line for that day and the first receiving number.

PO nopo lineRecvng noitemtrans date Report qty
MT194690011515001MP-5H10151920
MT194690012327001PT-809101910
MT194690013515002MC-3A HONDA10151910
MT194690013515002MC-3A HONDA10151910
MT1946900151308001AP-2103122010
MT1946900115746003ST541A021121195
MT19490001172001WIDE DIE07161952
MT1950000113522001RB 2214 TM0518211
MT195790011795001AP-31204192
MT195880011651001647521106191

 In the below you will notice that the dates do not match therefore I did not manually combine them into 1 line.

Screenshot 2024-12-19 110016.png

 

 

Please note I do not know dax, I am a beginer but i follow steps very well 🙂

 

 

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

 

How is the situation now? If my answer solved the problem, please accept it as a solution, which will be seen by more people in need.

 

 

Best regards,

Mengmeng Li

Anonymous
Not applicable

Hi @Anonymous ,

 

I don't quite understand what you mean, please provide some examples.

 

 

Best regards,

Mengmeng Li

Anonymous
Not applicable

Hi @Anonymous ,

 

Based on your description, you want to group rows with "qty" greater than 1 by: PO number, line number, and transaction date.

 

Here is my test for your reference.

Original table.

vmengmlimsft_0-1734664649138.png

Expected output.

vmengmlimsft_1-1734664678551.png

Calculated Table with DAX.

Table 2 = 
VAR calculateTable01 = CALCULATETABLE(SUMMARIZE(
    'Table',
    'Table'[PO no],
    'Table'[po line],
	'Table'[trans date ],"Report qty",SUM('Table'[Report qty]),"item",MAX('Table'[item]),"Recvng no",MAX('Table'[Recvng no])),'Table'[Report qty]=1)
VAR calculateTable02 = SELECTCOLUMNS(calculateTable01,"PO no",[PO no],"po line",[po line],"Recvng no",[Recvng no],"item",[item],"trans date",[trans date ],"Report qty",[Report qty])
RETURN UNION(FILTER('Table','Table'[Report qty]>1),calculateTable02)

 

 

 

 

Best regards,

Mengmeng Li

Anonymous
Not applicable

Is there a way to make this show the first/lowest receiving number on the combined line? this one shows the highest. That way when it is researched in the system they will see the other numbers if needed

lbendlin
Super User
Super User

You shared from a personal SharePoint/Onedrive.  You may not want to do that.  

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Anonymous
Not applicable

ty

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.