Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vilimaz
Regular Visitor

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.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@vilimaz 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())

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@vilimaz 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())

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.