cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Islam
Helper V
Helper V

A help with lookup table in power query

Hello Experts
i have a big problem and i can't solve it
i have a table that contains grade for each employee and a table which contains the grades ( fair , good , very good , excellent) and the lower and the upper limit for each category i wanna return each equivalent grade category text for each employee by filtering categories table by each employee grade for each row in student grades table filtering lower and upper limit
 
 
 
9 REPLIES 9
PhilipTreacy
Super User
Super User

@Islam 

I think you could do this with just an IF statement and not need a 2nd table with grades.

Please post some sample data, too hard to give an accurate solution without it.

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Didn't think about that 

i'll try this out and inform you of the result sir

ChrisMendoza
Super User
Super User

@Islam -

I tried to learn something new with @ImkeF solution at https://www.thebiccountant.com/2018/02/15/generic-switch-function-query-editor-in-power-bi-and-power... however, I failed trying to do a comparative operator; see [Custom] (Maybe ImkeF can show us how to do it with her nifty function). Then I found https://community.powerbi.com/t5/Desktop/How-to-lookup-values-in-another-table-in-the-Query-Editor/t... which produced:

image.pngimage.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Unfortunately that's not what i meant sir 

i have 2 tables 

one fact table with all employees transactions including secret report degree 

and another disconnected table with grade defined name ( fair - good - very good - excellent) and every grade have a range of lower and upper limit of grade 

what i want is add column in the fact table doing the following:

look up each single employee degree in the whole limits for each category  ( fair - good - very good - excellent) in the disconnected table and return the matching grade title into that added column in the fact table

Thanks for help sir but unfortunately it doesn't help coz i have a table with lower limit column and upper limit column for each category

@Islam - You don't need min/max limits as you can see in my sample. The operator acts like the rules of min/max "organically". Try it with your existing data [Max] and see if it produces the results you intend.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Ok I'll apply this and see what happens and inform you about it

Hey @Islam,

 

please create a pbix that contains sample data but still reflects your data model. Upload the pbix to onedrive or dropbox and share the link. If you are using Excel to create the sample data and share xlsx as well.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

I'm using power query and power pivot for excel but np I'll upload a sample and provide you with the link

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors