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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
aallman
Helper II
Helper II

How do I return only the first occurrence of a value in a table and all data in that row?

I have a table (Table1) with 2 unique identifiers, ReferenceID and ManufacturingID. ManufacturingID is unique and each only shows up once in the table, while some ReferenceIDs have mulitple ManufacturingIDs. This table is related to another table (Table2) by ReferenceID in a many to one relationship. (ManufacturingID does not exist in the second table) 

What I need to do is pull a few values from Table1 into a visual that currently only has values from Table2. I can't do this because of the relationship. What I want is to be able to pull in only the first line for each ReferenceID from Table1 and use those values in my visual. Is this possible?

Example Table1:

ReferenceIDManufacturingIDDateStatus
100015/5/23Fail
100025/7/23Pass
200035/5/23Pass
300045/7/23Fail
300055/8/23Pass

 

Example Table2:

ReferenceIDDepartmentType
1000MainStandard
2000MainSameDay
3000PlatinumStandard

 

Desired Output visual:

ReferenceIDDepartmentTypeDateStatus
1000MainStandard5/5/23Fail
2000MainSameDay5/5/23Pass
3000PlatinumStandard5/7/23Fail
2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table and a relationship (Many to One and Single) from the Date column of Table1 to the Date column of the Calendar Table.  To your visual, drag the first 3 columns from Table2.  Write these measures

First date = min('table1'[Date])

Status on first date = calculate(max('Table2'[Status]),datesbetween(Calendar[Date],[First date],[First date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
FreemanZ
Community Champion
Community Champion

hi @aallman 

try to add two calculated columns like:

Date =
MINX(
    RELATEDTABLE(Table1),
    Table1[Date]
)
 
Status =
LOOKUPVALUE(
     Table1[Status],
     Table1[ReferenceID], Table2[ReferenceID],
     Table1[Date], Table2[Date]
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.