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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
IvanS
Helper V
Helper V

LOOKUP within the same table

Hey guys,

 

I browsed several sources about how to lookup value within the same table, however any of those met my requirements.

 

I have one huge agile table that consists of stories (sub-tasks) and epics (main tasks/milestones). Every story is assigned under epic using the Epic Link reference. I would like to create calculated column/measure that will state the name of Epic on the story level. So basically, when the Epic Link value matches with Issue_Unique Key, the Epic name value will be copied into Story Epic Name column.

 

Example below:

 

Issue_Unique KeyIssue_TypeIssue SummaryEpic NameEpic LinkStory Epic Name (desired result using DAX)
DEV-1EpicEpic 1 Main taskEpic 1 Name  
DEV-2StoryStory sub-task DEV-1Epic 1 Name
DEV-3StoryStory sub-task DEV-1Epic 1 Name
DEV-4EpicEpic 2 Main taskEpic 2 Name  
DEV-5StoryStory sub-task DEV-4 Epic 2 Name

 

Any suggestions are much appreciated!

1 ACCEPTED SOLUTION

I see, for a measure MAX() or SELECTEDVALUE() should solve the issue:

ValtteriN_0-1639412409165.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
smpa01
Super User
Super User

@IvanS  you can use this measure

Measure =
VAR _epicName =
    MAX ( 'Table 1'[Epic Link] )
RETURN
    CALCULATE (
        MAX ( 'Table 1'[Epic Name] ),
        FILTER ( ALL ( 'Table 1' ), 'Table 1'[Issue_Unique Key] = _epicName )
    )

 

smpa01_0-1639413254287.png

 

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

Hi @smpa01 

 

for some reason, the function is not working in measure. Please find below - the names in official file are a bit different. You can see that calculated column is getting the Epic name however measure is blank (except one line from the list).

 

IvanS_0-1639416813215.png

 

@IvanS  can you provide a sample pbix?

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

I found the root cause of the issue - there was bilateral relationship between 2 tables which are part of matrix table. After change to sigle filterring, the both measures are working. 

 

I will mark measure from @ValtteriN as solution as it is not that much performance consuming. However thank you too for help!

ValtteriN
Super User
Super User

Hi,

Like you suggested Lookup is the way to go here is my DAX:

Epic = LOOKUPVALUE(Epics[Epic Name],Epics[ssue_Unique Key],Epics[Epic Link])

I am not sure if I am missing something, but the column returned matches your desired outcome:
ValtteriN_0-1639410525447.png


I hope this helps to solve your issue and if it does consider accepting this as a solution!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ValtteriN ,

 

yes, this is pulling the data into table - yet I need to add it into Matrix - for hiding the data on aggregated level in matrix I am using measure that consists of ISFILTERED.

 

IF(ISFILTERED(Issues[ISSUE_KEY]), SELECTEDVALUE(Issues[ISSUE_CURRENT_TYPE_NAME]), BLANK())

 

When creating your function as column, Power BI is automatically setting First with options Last, Count & Distinct count. Is there any way how to hide this information (or at least to write your function as measure)?

IvanS_0-1639411574774.png

 

The main issue with measures is that they cannot work with duplicate values and giving the below error.

IvanS_1-1639411847897.png

 

 

I see, for a measure MAX() or SELECTEDVALUE() should solve the issue:

ValtteriN_0-1639412409165.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors