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
dw700d
Post Patron
Post Patron

Merged queries resulting in duplicates

I am trying to merge two queries. The first query has Agents Credits given data. This query Identifies how many credits an agent gave each month they were employed. This query includes 4000 different agents and most of these agents have multiple entries because they have worked for multiple months. The second query Identifies how many customers each agent saw. This query includes 4900 different agents and most of these agents have multiple entries because the agent has worked multiple months. My objective is to have one complete data set that includes credits given for all agents and customers seen for all agents. I choose the left outer join which matched 20,792 out of the first 27,967 rows. My results came back with an extraordinary amount of duplicates . For instance ID # 1 has only three entrees in each individual table but after both tables are merged it now has 9 entrees. ID# 4 Has 8 entries in each table but 66 entries in the merged table. What am I doing wrong? Below is an example of the two individual tables and the merged table

 

Agent Credits
MonthRetailorSiteAgent ID #CreditsCredit Amount
JulyCambellsClara120$329.00
AugustCambellsClara118$245.06
JuneCambellsClara116$260.96
May

Cambells

Clara4831.51
JulyCambellsClara417107.45
JuneCambellsClara422164.01
SeptemberCambellsClara419198.34
NovemberCambellsClara4954.5
DecemberCambellsClara4785
AugustCambellsClara417128.3
OctoberCambellsClara421190.48

 

Agent Customer handled
Agent ID#RetailorSiteMonthCustomer Count
1CambellsClaraJune518
1CambellsClaraJuly594
1CambellsClaraAugust468
4CambellsClaraMay543
4CambellsClaraJune957
4CambellsClaraJuly993
4CambellsClaraAugust838
4CambellsClaraSeptember656
4CambellsClaraOctober914
4CambellsClaraNovember623
4CambellsClaraDecember385
merged table
MonthRetailerSiteAgent ID#CreditsCredit AmountID # Call HandledVend Call HandledSite Call HandledMonth Call Handled Call Count Call Handled
JulyCambellsClara120$329.001CambellsClaraJune518
AugustCambellsClara118$245.061CambellsClaraAugust468
JuneCambellsClara116$260.961CambellsClaraJuly594
JulyCambellsClara120$329.001CambellsClaraAugust468
AugustCambellsClara118$245.061CambellsClaraJune518
JuneCambellsClara116$260.961CambellsClaraAugust468
JulyCambellsClara120$329.001CambellsClaraJune518
AugustCambellsClara118$245.061CambellsClaraJuly594
JuneCambellsClara116$260.961CambellsClaraJuly594
MayConvergysClara4831.514CambellsClaraMay543
JulyConvergysClara417107.454CambellsClaraMay543
JuneConvergysClara422164.014CambellsClaraJune957
SeptemberConvergysClara419198.344CambellsClaraJuly993
NovemberConvergysClara4954.54CambellsClaraSeptember656
DecemberConvergysClara47854CambellsClaraSeptember656
AugustConvergysClara417128.34CambellsClaraOctober914
OctoberConvergysClara421190.484CambellsClaraMay543
NovemberConvergysClara4954.54CambellsClaraMay543
DecemberConvergysClara47854CambellsClaraAugust838
AugustConvergysClara417128.34CambellsClaraSeptember656
OctoberConvergysClara421190.484CambellsClaraOctober914
1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@dw700d

 

Did you select both ID and Month columns when doing the merge?

 

merge.png


Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@dw700d

 

Did you select both ID and Month columns when doing the merge?

 

merge.png


Regards
Zubair

Please try my custom visuals

that did the trick thank you

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.