Convert time based VLOOKUP to DAX formula

Daveconva

New Member
Joined
May 22, 2016
Messages
10
My current formula is below with an explanation of my data:

Would it be possible to write this in DAX?

=IFERROR(VLOOKUP(K2,K3:M40000,IF($M:$M=0,2,3),FALSE),"01/01/2010")
Column K = A Unique Value i.e Product 1, Product 2, Product 3 etc…..
Column L = Dates in order of newest to oldest
Column M = Dates in no particular order

So the VLOOKUP looks down the columns and when it sees the next instance of the Unique Key it then gives me the date value in Column M and if there is no new instance of the Unique Key found it returns 01/01/2010.

Column Headings in DAX would be:
Column K = Unique Key
Column L = Date Start
Column M = Date Finished
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
The question is a bit vague as you haven't indicated how (or even if) the pivot is setup (what you want on rows/columns), or if this is to be a calculated column(?) or cube formula(?). Do you have a model built? What version of Excel/Power BI are you using?

I'm sure what you want can be done in Dax, but need a clearer understanding of variables so to speak.
 
Upvote 0
The question is a bit vague as you haven't indicated how (or even if) the pivot is setup (what you want on rows/columns), or if this is to be a calculated column(?) or cube formula(?). Do you have a model built? What version of Excel/Power BI are you using?

I'm sure what you want can be done in Dax, but need a clearer understanding of variables so to speak.

Hi.

Link to example data is below, hopefully edit access allows you to see the formulas I currently have.

https://1drv.ms/x/s!AuSdQxz4X7xXgRXDvAHIjPFjkNdb

Please look at worksheet YILO and YTD in the file (other one is another DAX issue im having)

Columns E,F,G are all similar so if you can just help with one i should be able to copy for the other two columns.

Yes it will be a calculated column

I can sort out pivot chart once I get this new calculated column up and running

Thank you one again
 
Upvote 0

Forum statistics

Threads
1,215,459
Messages
6,124,947
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top