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
irnm8dn
Post Prodigy
Post Prodigy

Inventory Dashboard - Matching IDs in two tables to determine status. Many:1 Relationship

I have two datasets.  One showing the available Inventory of Products over time, the other Products Sold and Part IDs.

 

In a dashboard, I have to show all Products both Sold and Available.  This "status" will be determined by whether an ID appears in both datasets or not.

 

 

**This is where I am struggling most.  I need a solution that addresses a Many:1 relationship of repeating Item IDs in the Sold data, and a unique Item ID in inventory during the match process.  Many of Power BIs functions require unique IDs in each of two columns to "match" between two datasets.

 

In the dashboard, I'd like to show the following in a hierarchical table

 

  • Show Item ID (not repeating)
  • Show status Sold or Available
    • If Item ID appears in both datasets then "Sold", if Item ID does not appear in both tables "Available"
    • The solution needs to address that Item ID may repeat in the "Sold" dataset, hence Many:1 
  • Show the Part IDs under the Item ID when SOLD.

 

I have created (2) sample datasets, one representing Available Inventory, the other what's Sold.

 

https://www.dropbox.com/s/gbzdwo6qxxt026x/Sample%20Data.xlsx?dl=0

 

Thanks in advance.  Appreciate a link to a .pbix file if possible.

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@irnm8dn,

Create a column in the Inventory table using DAX below.

Status = IF(CALCULATE(COUNTROWS(Sold), FILTER( Sold, Sold[Item ID] = EARLIER(Inventory[Item ID]) ) ) > 0,"Sold","Available")


Create table visuals as below.
1.JPG2.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuezhe-msft
Employee
Employee

@irnm8dn,

Create a column in the Inventory table using DAX below.

Status = IF(CALCULATE(COUNTROWS(Sold), FILTER( Sold, Sold[Item ID] = EARLIER(Inventory[Item ID]) ) ) > 0,"Sold","Available")


Create table visuals as below.
1.JPG2.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yuezhe-msft

 

This worked wonderfully.  Can you break down the dax statement so I understand what's happening, and how it works?

 

Thanks!

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.