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
AlexanderPrime
Solution Supplier
Solution Supplier

LOOKUPVALUE Column Value from a row based on another column's value

Hi all.

 

I'm trying to get a value from another row based on a value within the current row.

 

I have the following:

Tablename: Subgroup

WKYR     TY  LY   LASTWKYR
202033    1000     201933
202133    3200    202033

 

Essentially I'm trying to make the LY column in the 202133 row pull the 1000 into it based on the 202033 value in both WKYR and LASTWKYR, with a fall back to 0 if there is no value for it to look up, which in this table would result in LY in the 202033 row be 0. 

I've tried: 

LY = LOOKUPVALUE(
Subgroup[TY],
Subgroup[LASTWKYR],
Subgroup[WKYR],
0
)
 
But it doesn't appear to work? Am I missing something obvious or am I aiming in the wrong direction here? Unable to use SAMEPERIODLASTYEAR or DATE formats due to constraints with how data is reported. 
 
Desired end result:

Tablename: Subgroup

WKYR    TY   LY   LASTWKYR
202033    1000     0   201933
202133    3200   1000   202033

 


Please note - I am not affiliated with Microsoft, I'm just an end user like yourself.
Just a regular guy doin' Data Science.

If my post has helped you, please don't forget to thumbs up or click "Accept as solution" if it solved your problem!
1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Haven't you just got your second and third arguments the wrong way wrong?

LY =
LOOKUPVALUE ( Subgroup[TY], Subgroup[WKYR], Subgroup[LASTWKYR], 0 )

Regards

View solution in original post

3 REPLIES 3
Jos_Woolley
Solution Sage
Solution Sage

😁Not quite time for the pub yet!

 

Jos_Woolley
Solution Sage
Solution Sage

Haven't you just got your second and third arguments the wrong way wrong?

LY =
LOOKUPVALUE ( Subgroup[TY], Subgroup[WKYR], Subgroup[LASTWKYR], 0 )

Regards

Well now I feel dumb, thanks Jos!

(I blame it on a bad case of the Fridays!)


Please note - I am not affiliated with Microsoft, I'm just an end user like yourself.
Just a regular guy doin' Data Science.

If my post has helped you, please don't forget to thumbs up or click "Accept as solution" if it solved your problem!

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.

Top Solution Authors