Forum Discussion
Converting Tableau function into Power BI DAX
IF LOOKUP(MIN([ID]),0) = LOOKUP(MIN([ID]),-1)
Need to convert this Tableau function into DAX, I have attaced sample data for your reference.
Hi Anonymous ,
According to your description, refer to the following formula whether to meet your going:
col_new = VAR _max = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALL ( 'Table' ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) && 'Table'[Date] < EARLIER ( 'Table'[Date] ) ) ) RETURN DATEDIFF ( _max, 'Table'[Date], DAY )
If the problem is still not resolved, please point it out. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandakSuper User
Anonymous , a new column
var _max = maxx(filter(Table, [ID] = earlier([ID]) && [Date] < earlier([Date]) ), [Date])
return
datediff(_max, [Date], day)
- v-henryk-mstfCommunity Support
Hi Anonymous ,
According to your description, refer to the following formula whether to meet your going:
col_new = VAR _max = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALL ( 'Table' ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) && 'Table'[Date] < EARLIER ( 'Table'[Date] ) ) ) RETURN DATEDIFF ( _max, 'Table'[Date], DAY )
If the problem is still not resolved, please point it out. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.