Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

I can mimic SQL Lag but not SQL Lead... Dax help please!

Hello, I'm trying to mimic the SQL function LEAD in Power BI.  I have a table representing emails that have been sent to customers.  There is a column for CustomerID, a column called Sequence which ...
  • amitchandak's avatar
    5 years ago

    Anonymous , These two columns will give you previous and next

     

    maxx(filter(tablename, CustomerID=earlier(CustomerID) && Sequence<earlier(Sequence)),[DateOfEmail])

     

    minx(filter(tablename, CustomerID=earlier(CustomerID) && Sequence >earlier(Sequence)),[DateOfEmail])