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
meklund
Frequent Visitor

Calc Column marking earliest dates

Hello, 

Just started using DAX, powerpivot, and power BI and loving it. I'm trying to make a Calc Column for the earliest project date for each of our agents (sample data below). I imagine it looks something like SWITCH(TRUE,AND([Date of Project]=??,[agent code]=??),"FIRST PROJECT","") that goes into the flag column. 

but any help would be cool 🙂

AgentCodeProjectDateProjectNameFLAG?
1234566/4/2019Project 212 
1234563/1/2020Project 564 
1234569/23/2020Project 951 
2345679/2/2020Project 367 
45678912/7/2019Project 852 
4567893/9/2020Project 264 
1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

You should probably do this as a measure instead but it is common for people new to Power BI to overuse calculated columns.  Here is a column expression to get your result, but it would work as a measure too (in a table visual with the AgentCode column).

 

First Project Date = CALCULATE(MIN(Table[ProjectDate]), ALLEXCEPT(Table, Table[AgentCode]))

 

Regards,

Pat

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Employee
Employee

You should probably do this as a measure instead but it is common for people new to Power BI to overuse calculated columns.  Here is a column expression to get your result, but it would work as a measure too (in a table visual with the AgentCode column).

 

First Project Date = CALCULATE(MIN(Table[ProjectDate]), ALLEXCEPT(Table, Table[AgentCode]))

 

Regards,

Pat

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.

Top Solution Authors