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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculate using columns with duplicated data

I'm working with some messy sales win/loss data, and I need help. My goal is to calculate vendor consideration rate and vendor win rate. The data table includes the following columns:

  • ID: a unique ID for each deal
  • Winning Vendor: the name of the vendor who won the deal
  • Losing Vendors: the names of all other vendors considered, but not chosen (delimited with semicolons)

I've parsed the Losing Vendors field into separate rows in Power Query. The result for the 'Deals' table looks like this:

IDWinning VendorLosing Vendors
1Vendor AVendor B
1Vendor AVendor C
1Vendor AVendor D
2Vendor BVendor A
2Vendor BVendor D
3Vendor BVendor C
3Vendor BVendor E
4Vendor CVendor A
4Vendor CVendor B
4Vendor CVendor D
4Vendor CVendor E
4Vendor CVendor F
5Vendor D 
6Vendor AVendor B
6Vendor AVendor E
6Vendor AVendor F
7Vendor EVendor B
7Vendor EVendor C
7Vendor EVendor D
7Vendor EVendor F
8Vendor BVendor A
8Vendor BVendor C
8Vendor BVendor D
8Vendor BVendor E
8Vendor B

Vendor F

 

Calculating the respective vendor win rates is easy enough:

Vendor Win Rate =

DIVIDE(DISTINCTCOUNT([ID]),

CALCULATE(DISTINCTCOUNT([ID]), ALL(Deals[Winning Vendor])),0)

 

Summarizing the data for Losing Vendors is just a straight COUNT of ID for each vendor in the Losing Vendors column.

My challenge is in joining the two calculations, since the vendor names are duplicated across the two columns. Put another way, how do I join the two different vendor name fields so I can get counts for both wins and losses for each vendor?

 

I tried creating a UNION table of distinct vendor names, but when I create a relationship with 'Deals'[Losing Vendors] and try to make it active, I get an error:

You can't create a direct active relationship ... because an active set of indirect relationships already exists between these tables.

 

The calculation I want to be able to make include:

Vendor Consideration Rate = ([Win Count] + [Loss Count]) / [Deal Count]

 

I then want to create a scatter plot of vendors with Vendor Consideration Rate on the x-axis and Vendor Win Rate on the y-axis.

 

I have created an Excel file with the result I want here:

Vendor Win-Loss.xlsx

And a .pbix file with what I've tried so far here:

Vendor Win-Loss.pbix

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous Probably the easiest way is to create a disconnected table that lists all of your vendors. We will call this the Vendors table and the column that holds the names of the vendors is called Vendor. Then you can put this into a visualization along with this measure:

Measure = 
  VAR __Vendor = MAX('Vendors'[Vendor])
  VAR __Deals = COUNTROWS(DISTINCT('Deals'[ID]))
  VAR __Wins = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER('Deals',[Winning Vendor] = __Vendor),"__ID",[ID])))
  VAR __Losses = COUNTROWS(FILTER('Deals',[Losing Vendor] = __Vendor))
RETURN
  DIVIDE(__Wins + __Losses, __Deals, 0)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Anonymous Probably the easiest way is to create a disconnected table that lists all of your vendors. We will call this the Vendors table and the column that holds the names of the vendors is called Vendor. Then you can put this into a visualization along with this measure:

Measure = 
  VAR __Vendor = MAX('Vendors'[Vendor])
  VAR __Deals = COUNTROWS(DISTINCT('Deals'[ID]))
  VAR __Wins = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER('Deals',[Winning Vendor] = __Vendor),"__ID",[ID])))
  VAR __Losses = COUNTROWS(FILTER('Deals',[Losing Vendor] = __Vendor))
RETURN
  DIVIDE(__Wins + __Losses, __Deals, 0)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 
Thank you. That works!
I had previously created a table of all vendors using a UNION statement, as follows:

All Vendors =
VAR vendorTable = FILTERDISTINCTUNION(
        VALUES(Deals[Winning Vendor]),
        VALUES(Deals[Losing Vendors]))),
   NOT( ISBLANK([Winning Vendor])))
RETURN
SELECTCOLUMNS(vendorTable, "Vendor", [Winning Vendor])
My problem was that I had linked it back to the original 'Deals' table. When I disconnect it and use it in the measure you provided, it also works.

Thanks again!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.