cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EnrichedUser
Helper II
Helper II

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
Eyelyn9
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!






New Animated Dashboard: Sales Calendar


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



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Item Branch is just a table with unique items. 

Inventory has duplicates of items and sales has duplicates. 

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors