Forum Discussion
oscargushiken
3 years agoFrequent Visitor
Conditional Merge Queries based on column value
Dear forum, Would would be the best way to merge data from a bottom row based on meeting a specific column value? I was attmepting to do this using two offset Index columns and then execute a no...
- Anonymous3 years ago
Hi oscargushiken ,
I have created a simple sample, please refer to it to see if it helps you.
Create a measure.
result = CALCULATE ( MAX ( 'date'[JOB_CODE] ), FILTER ( ALL ( 'date' ), 'date'[EMPLOYEE_ID] = SELECTEDVALUE ( 'date'[EMPLOYEE_ID] ) && 'date'[Index] = SELECTEDVALUE ( 'date'[Index] ) + 1 ) )Or a column.
Column = CALCULATE ( MAX ( 'date'[JOB_CODE] ), FILTER ( ALL ( 'date' ), 'date'[EMPLOYEE_ID] = EARLIER ( 'date'[EMPLOYEE_ID] ) && 'date'[Index] = EARLIER ( 'date'[Index] ) + 1 ) )How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - 3 years ago
Hi,
This calculated column formula works
Column = LOOKUPVALUE(Data[JOB_CODE],Data[DATE],CALCULATE(MAX(Data[DATE]),FILTER(Data,Data[EMPLOYEE_ID]=EARLIER(Data[EMPLOYEE_ID])&&Data[DATE]<EARLIER(Data[DATE]))),Data[EMPLOYEE_ID],Data[EMPLOYEE_ID])Hope this helps.
oscargushiken
3 years agoFrequent Visitor
Thank you Ashish - this solution worked. I was so fixated on using Power Query, that I was not considering DAX.
Ashish_Mathur
3 years agoSuper User
You are welcome.