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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
EnrichedUser
Helper III
Helper III

Return measure in the context of another table

I have a measure called Top Customer that is calculated in a sales table. It identifies the customer code an item is sold to the most.

Top Customer = 
FIRSTNONBLANK (
    TOPN (
        1, 
        VALUES ( Sales[CustomerID] ), 
        RANKX( ALL( Sales[CustomerID] ), _Measures[Times Imported],,ASC)
    ), 
    1 
)

 

I would like to return this measure in the context of my inventory table.

 

I do have an intermediate table called Item Branch that has all unique items as there are duplicates in the inventory and sales table.

 

EnrichedUser_0-1640014617422.png

 

Expected Output as table visual:

 

Inventory.Item TopCustomer

A                        AA
B                        AB

Thanks in advance and any SQLBI or related articles, I love to read. 

 

 

4 REPLIES 4
Anonymous
Not applicable

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

 

Refer to:

How to Get Your Question Answered Quickly

How to provide sample data in the Power BI Forum

 

 

Best Regards,
Eyelyn Qin

smpa01
Super User
Super User

@EnrichedUser  is it kindly possible to provide a pbix (small) representative of your issue

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
amitchandak
Super User
Super User

@EnrichedUser , I doubt you can get it for an inventory item easily. what is the difference between Inventory.Item and ItemBranch.ItemID - are there more than one description, because you should try the same ItemBranch.ItemID or ItemBranch.Item

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Item Branch is just a table with unique items. 

Inventory has duplicates of items and sales has duplicates. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors