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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.