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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
amtbew
Helper I
Helper I

Count Occurrences of #1 RankX Measure

Hi,

 

My data is as follows.

amtbew_0-1704558478017.png

I have two Measures: 

Lowest Proposal = min(Proposal[Vendor Bid])

&

Proposal Rank = if(ISBLANK([Lowest Proposal])
, blank ()
, rankx(
filter(ALL(Proposal[Vendor ID]), not (ISBLANK([Lowest Proposal])))
, [Lowest Proposal]
,
,1
)
)

 
 
What I'm trying to do is get a count of the number of times a Vendor had the #1 Proposal Rank accross all of the Product IDs
 
So the expected outcome with this data would be 
A1 - 2
A2 - 1
 
Thanks
2 ACCEPTED SOLUTIONS
Dangar332
Super User
Super User

hi, @amtbew  

 

try below measure

 

rank = 
var a = SUMMARIZE(
          'Table',
          'Table'[product id],
          'Table'[lowest proposal],
          'Table'[vender id],
          "rank",RANK(
                    DENSE,
                    ALL('Table'),
                    ORDERBY('Table'[lowest proposal],ASC),,
                    PARTITIONBY('Table'[product id])
                )
        )
return
COUNTX( FILTER(a, [rank]=1),'Table'[vender id])

 

Dangar332_0-1704560659626.png

 

View solution in original post

hi, @amtbew 

try below

Measure 3 = 
var a = ADDCOLUMNS( SUMMARIZE(Proposal,Proposal[Product ID],Proposal[Vendor ID]),"low",[Lowest Proposal],"rank",[Proposal Rank])
return
 COUNTX(FILTER(a,[Proposal Rank]=1),Proposal[Vendor ID])

 

Dangar332_0-1704567190518.png

 

View solution in original post

7 REPLIES 7
Ahmedx
Super User
Super User

pls try this

Screenshot_4.png

or this try

Screenshot_5.png

Both ones you posted seemed to work. Thanks

Dangar332
Super User
Super User

hi, @amtbew  

 

try below measure

 

rank = 
var a = SUMMARIZE(
          'Table',
          'Table'[product id],
          'Table'[lowest proposal],
          'Table'[vender id],
          "rank",RANK(
                    DENSE,
                    ALL('Table'),
                    ORDERBY('Table'[lowest proposal],ASC),,
                    PARTITIONBY('Table'[product id])
                )
        )
return
COUNTX( FILTER(a, [rank]=1),'Table'[vender id])

 

Dangar332_0-1704560659626.png

 

Thanks @Dangar332  howver it's returning the following error

The column 'lowest proposal' specified in the 'SUMMARIZE' function was not found in the input table.

 

Perhaps because that is a measure not a column?

 

Here's a pbix

https://www.dropbox.com/scl/fi/q84z8jf3hvn34cuyyu1n8/CountRankX.pbix?rlkey=l9ugoaa87n2r3qbbjdcrke9ll...

 

Thanks

hi, @amtbew 

try below

Measure 3 = 
var a = ADDCOLUMNS( SUMMARIZE(Proposal,Proposal[Product ID],Proposal[Vendor ID]),"low",[Lowest Proposal],"rank",[Proposal Rank])
return
 COUNTX(FILTER(a,[Proposal Rank]=1),Proposal[Vendor ID])

 

Dangar332_0-1704567190518.png

 

This one worked. Thank you

Helpful resources

Announcements
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.