Forum Discussion
New column based on if statement with lastdate condition
Hi,
I am quite new in PBI and i need some help.
I am creating a customer history from multiple sources and i need to add a filter for the latest interaction. I was thinking to create a new column with indexing 1/0.
I see that I need to create a new column with a record for each row where I index data 0/1 or true/false for lastdate for each customer (which has multiple records in the dataset). Group by is not good for me as I need a new column and DAX, unfortunately, can give me the lastdate solution (not a new column).
I would really appreciate the solution or maybe some other approach to achieve my goal.
- Anonymous6 years ago
Anonymous Please try something like this.
For each customer there must be an id or name I'm assuming it as Customer_Id and there would be a date column.
Column = VAR _latestDate = CALCULATE(MAX(Test[Report_Date]),ALLEXCEPT(Test,Test[Customer_Id])) RETURN IF(Test[Report_Date]=_latestDate,TRUE(),FALSE())
1 Reply
- AnonymousNot applicable
Anonymous Please try something like this.
For each customer there must be an id or name I'm assuming it as Customer_Id and there would be a date column.
Column = VAR _latestDate = CALCULATE(MAX(Test[Report_Date]),ALLEXCEPT(Test,Test[Customer_Id])) RETURN IF(Test[Report_Date]=_latestDate,TRUE(),FALSE())