Forum Discussion
samirineni
5 years agoFrequent Visitor
Ranking Measure Help over Peer Group
I have below scenario in my datamodel and looking for solution to create measure for ranking with vendor versus peer vendor. Table A: VendorID Date Qty A 2021-01-31 100 B ...
v-kelly-msft
5 years agoCommunity Support
Hi samirineni ,
First create 2 dimension tables for month and vendorID.
Then create 3 measures as below:
_rank = RANKX(FILTER(ALL('Vendor Txn Table'),'Vendor Txn Table'[Month]=MAX('Vendor Txn Table'[Month])),CALCULATE(SUM('Vendor Txn Table'[Qty])),,DESC,Dense)Measure =
var _id=CALCULATE(MAX('Vendor Master Table'[VendorID]),FILTER(ALL('Vendor Master Table'),'Vendor Master Table'[VendorName]=SELECTEDVALUE(slicer[VendorName])))
Return
CALCULATE('Vendor Txn Table'[_rank],FILTER(ALL('Vendor Txn Table'),'Vendor Txn Table'[Month]=SELECTEDVALUE('calendar table'[Month])&&'Vendor Txn Table'[VendorID]=_id))
_peer vendor ID =
var _id=CALCULATE(MAX('Vendor Master Table'[VendorID]),FILTER(ALL('Vendor Master Table'),'Vendor Master Table'[VendorName]=SELECTEDVALUE(slicer[VendorName])))
var _tab=CALCULATETABLE(VALUES('Vendor_Peer mapping table'[PeerVendorID]),FILTER(ALL('Vendor_Peer mapping table'),'Vendor_Peer mapping table'[VendorID]=_id))
Return
IF(MAX('Vendor_Peer mapping table'[PeerVendorID]) in _tab,1,BLANK())
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
samirineni
5 years agoFrequent Visitor
I am trying to use your PBIX file and cannot derive the desired rank using measures that given in PBIX? Can you help how to read or you can see below data i am trying to derive using sample set provided by you.