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
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
v-eqin-msft
Community Support
Community Support

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

Item Branch is just a table with unique items. 

Inventory has duplicates of items and sales has duplicates. 

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.