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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
smpa01
Community Champion
Community Champion

Path reverse lookup

Is there any way to achieve a reverse look up that returns the memeber position on the path?

 

I have this

 

| rowNum | pathString       | individiualValue |
|--------|------------------|------------------|
| 1      | 6000|5000|4000   | 6000             |
| 1      | 6000|5000|4000   | 4000             |
| 2      | 8000|9000|7000   | 1000             |
| 3      | 8000|9000|7000   | 8000             |

 

 

I want to end up with this

 

| rowNum | pathString       | individiualValue | position |
|--------|------------------|------------------|----------|
| 1      | 6000|5000|4000   | 6000             | 1        |
| 1      | 6000|5000|4000   | 4000             | 3        |
| 2      | 8000|9000|7000   | 1000             |          |
| 3      | 8000|9000|7000   | 8000             | 1        |

 

 

I can currently achieve it with this

 

Table = 
VAR baseTbl =
    DATATABLE (
        "rowNum", INTEGER,
        "pathString", STRING,
        "individiualValue", STRING,
        {
            { 1, "6000|5000|4000", "6000" },
            { 1, "6000|5000|4000", "4000" },
            { 2, "8000|9000|7000", "1000" },
            { 3, "8000|9000|7000", "8000" }
        }
    )
VAR modTbl =
    SUMMARIZE ( baseTbl, [rowNum], [pathString] )
VAR lookupTbl =
    GENERATE (
        modTbl,
        ADDCOLUMNS (
            GENERATESERIES ( 1, PATHLENGTH ( [pathString] ) ),
            "ind", PATHITEM ( [pathString], [Value], TEXT )
        )
    )
VAR res =
    GENERATEALL (
        baseTbl,
        VAR ky1 = [rowNum]
        VAR ky2 = [pathString]
        VAR ky3 = [individiualValue]
        RETURN
            SELECTCOLUMNS (
                FILTER ( lookupTbl, [rowNum] = ky1 && [pathString] = ky2 && [ind] = ky3 ),
                "position", [Value]
            )
    )
RETURN
    res

 

 But is there a built-in syntax available to tackle this or any other optimized way?

@AlexisOlson  @CNENFRNL 


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Try this as a calculated column:

position = 
MINX (
    FILTER (
        GENERATESERIES ( 1, PATHLENGTH ( [pathString] ) ),
        PATHITEM ( [pathString], [Value] ) = [individualValue]
    ),
    [Value]
)

View solution in original post

5 REPLIES 5
AlexisOlson
Super User
Super User

Try this as a calculated column:

position = 
MINX (
    FILTER (
        GENERATESERIES ( 1, PATHLENGTH ( [pathString] ) ),
        PATHITEM ( [pathString], [Value] ) = [individualValue]
    ),
    [Value]
)

👍


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================
jdbuchanan71
Super User
Super User

@smpa01 

If the length of the string you are looking for is always the same can you do it mathematically?

Position = 
VAR _Search = SEARCH('Table'[individiualValue],'Table'[pathString],1,BLANK())
RETURN IF ( NOT ISBLANK ( _Search ), ( _Search - 1 ) / 5 + 1 )
CNENFRNL
Community Champion
Community Champion

Hi, my friend, List.PositionOf() from PQ asked me to pass a message on to you, this task is totally a light weight for it.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

smpa01
Community Champion
Community Champion

Appreciate !!! but I need a DAX solution.


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors