Forum Discussion
Help with equivalent PowerBI ISNA and VLOOKUP Function
Hello,
Apologies as I’m still new to PowerBI. In PowerBI I have 2 tables that are connected via 1-to-many:
- UserLookup – contains simple user data for our application such as their name, start date, etc.
- TimesheetData – contains weekly timesheet data for each user that submits their hours worked in our application.
I am trying to take all users in the UserLookup table and essentially do a VLOOKUP formula to find the user’s timesheet approval status from the TimesheetData table. The TimesheetData table would only show ‘Approved’ and ‘Pending’ status, and for any user that does not show up in that table, I want it to say ‘Missing’.
Here is the Excel formula I would use:
=IF(ISNA(VLOOKUP(A2,Time,4,0)),"MISSING",VLOOKUP(A2,Time,4,0))
Is there something I can use in PowerBI that could provide me with similar results? I have been trying to use the LOOKUPVALUE function in PowerBI, but I keep getting errors or everyone ends up showing ‘Missing”.
Anonymous add the following measure, change column, and table name as per your model.
Measure = VAR __status = CALCULATE ( LASTNONBLANK ( Timesheet[Status], 1 ) ) RETURN IF ( __status == BLANK(), "Missing", __status )I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
5 Replies
- parry2k
Super User
Anonymous there are many ways to do this, quick question, do these tables have a relationship? if yes, is it one to many, means, one records in the user table and many records for the same user in a timesheet, or it is one to one, means the only record in the user table and one record for the same user in the timesheet?
Solution will be dependent on this relationship.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
- AnonymousNot applicable
Hey, thank you for the reply. The relationship between the two tables are in fact one-to-many.
- parry2k
Super User
Anonymous add the following measure, change column, and table name as per your model.
Measure = VAR __status = CALCULATE ( LASTNONBLANK ( Timesheet[Status], 1 ) ) RETURN IF ( __status == BLANK(), "Missing", __status )I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡