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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
John1232
Frequent Visitor

Lookup Value Horizontally

How do you Hlookup on Dax or PBI,  Say as example I have this table and I have values in horizontal mode, I need to search up the date and matching the date with the header date I need that to bring me a value. In excel is very simple I just make an HLOOKUP to crosscheck for the date on top of each column and bring me back the value depending on the date and row selected. 

 

John1232_0-1679518000168.png

 

how do I replicate this exact same scenario on PBI, I need to crosscheck a date with the header and then bring me the value. I dont want to unpivot because I have unique values that I cant lose . Ive tried Lookup but it will not let me select more than one column and I need to search in all horizontally, any help will be appreciated 

3 REPLIES 3
WinterMist
Impactful Individual
Impactful Individual

@John1232 

 

I am confused by the expected results from your screenshot.

 

WinterMist_1-1679580467050.png

 

Row 1 of Expected Results shows Answer = Value 3

   - WHERE Unique Value = 1 AND Date = 3/3/2023

   - However, this does not match the source Lookup table.  Answer should be Value 1.

Row 2 of Expected Results shows Answer = Value 3

   - But again, based on the source Lookup table, the answer should be Value 1.

Row 3 shows Answer = Value 2, but should be Value 3.

Only Row 4 appears to be correct with Value 2.

 

Can you help me understand how you are calculating these values that seem to be incorrect?

 

NOTE 1: You mention that when you unpivot, it creates "duplicates" in the unique value column and will no longer support a relationship.  However, these are not true duplicates.  They actually reflect the data that is already there prior to unpivoting.  If you leave the data as is, you still cannot use Unique Value by itself to get your Answer.  It must be a combination of 2 items: Unique Value + Date.  This will be true regardless of whether you unpivot or not.  

 

NOTE 2: Due to two date columns being identical (3/14 & 3/14), you actually do have 4 instances of true duplicates:

WinterMist_0-1679583963950.png

 

WinterMist_2-1679581288468.png

 

WinterMist_3-1679581312575.png

 

WinterMist_4-1679581332078.png

 

Are these valid duplicates?  Or do they need to be corrected?

 

Can you provide a small sample data set for the other table you need to join to?
Does that table have both the "Key" as well as the Date?

(I say "Key" because this column is not a true Key.  The actual Key is Key + Date.)

 

Regards,

Nathan

amitchandak
Super User
Super User

@John1232 , I think you try to use unpivot in power query

Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you very much for your answer

 

The problem is that I need to use the unique value to match this with another table, and when I unpivot this will create duplicates in the unique value and will no longer support a relationship cause it will count as many to many from both tables giving an error.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.