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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
p1nkman
Helper I
Helper I

Return duplicate rows only on same dates and same quantity

Hi guys,

 

I am pretty much a beginner in PBI. I have a table where I have repeating ID's on the same date with sometimes the same quantity number and sometimes different. 

 

IDDateQTY
12315/11/20222000
12315/11/20222000
135816/11/20222400
105316/11/20221200
145720/11/20221500
145720/11/20221500
94322/11/2022200
84322/11/2022100
12325/11/2022210
135826/11/2022420
534527/11/20221300
534527/11/20221210

 

I need to match the same ID on the same dates which has the same quantities. Final solution should look like this:

 

IDDateQTY
12315/11/20222000
12315/11/20222000
145720/11/20221500
145720/11/20221500

 

Thank you for your time!

 

 

p1nkman_0-1669579055141.png

p1nkman_1-1669579064084.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @p1nkman ,

 

1.Filter out duplicate values back in the Power BI visual, so you need to create a column with different numeric values, first you can create an Index column in Power Query and then apply it to the report

 

vxinruzhumsft_0-1669699306127.png

 

2.Next, to create a measure in the report, enter the following code

 Measure = var a = FILTER(ALL('Table'),'Table'[Date]=SELECTEDVALUE('Table'[Date])&&'Table'[ID]=SELECTEDVALUE('Table'[ID])&&'Table'[QTY]=SELECTEDVALUE('Table'[QTY])) return IF(COUNTAX(a,[ID])>1,1,0)

 

3.Apply this measure to view filtering

 

vxinruzhumsft_1-1669699306132.png

 

 

Best Regards,

Yolo Zhu

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

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @p1nkman ,

 

1.Filter out duplicate values back in the Power BI visual, so you need to create a column with different numeric values, first you can create an Index column in Power Query and then apply it to the report

 

vxinruzhumsft_0-1669699306127.png

 

2.Next, to create a measure in the report, enter the following code

 Measure = var a = FILTER(ALL('Table'),'Table'[Date]=SELECTEDVALUE('Table'[Date])&&'Table'[ID]=SELECTEDVALUE('Table'[ID])&&'Table'[QTY]=SELECTEDVALUE('Table'[QTY])) return IF(COUNTAX(a,[ID])>1,1,0)

 

3.Apply this measure to view filtering

 

vxinruzhumsft_1-1669699306132.png

 

 

Best Regards,

Yolo Zhu

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

@Anonymous 

Hey never mind my last reply, I messed up the data types. It works! Thanks a lot !!

Hey @Anonymous , I didn't get the first step 😞 Could you please elaborate bit more? I am fairly new to Power BI. Thank you!

Mikelytics
Resident Rockstar
Resident Rockstar

HI @p1nkman ,

 

Sorry I did not read correctly. But here is the solution. 🙂

 

 

my samples starting point. As you can see there are duplicates.

Mikelytics_0-1669581839709.png

In Power Query there is also a "Keep Duplicates" feature

Mikelytics_1-1669581888864.png

After

Mikelytics_2-1669581906345.png

 

you can also do that with more than 2 columns.

 

Best regards

Michael

-----------------------------------------------------

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

@ me in replies or I'll lose your thread.

-----------------------------------------------------

LinkedIn

 

 

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Thanks for the reply. It won't work because I need to return the same IDs on the same dates with same Qty. It can happen that one date has duplicates but the IDs are different on those dates. Hope I could explain it clearly

Hi @p1nkman 

Did you try it? Because it should work and based on your sample data you will get the result you asked for

Can you please do the steps and show me where it does not work?

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
Mikelytics
Resident Rockstar
Resident Rockstar

Hi @p1nkman 

 

When you load the data into power query you can use the remove duplicate feature to get unique rows. Before you use it you have to reduce the columns on the granularity you need.

 

Mikelytics_0-1669579909835.png

 

 

Best regards

Michael

-----------------------------------------------------

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

@ me in replies or I'll lose your thread.

-----------------------------------------------------

LinkedIn

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

I'd like to keep the duplicates that are on the same date and same qty. How would removing duplicates help? Maybe I missed your point, sorry

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.