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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
DBrito79
Frequent Visitor

Ayuda en Formula DAX - devolver una fecha para egual primary ID y service >1

Hola,

Me podeis ayudar en una formula para una columna que devolva una fecha (mating Date) para egual primary ID y service >1

Algo como "return (mating date , if primary identidy are the same && service >1)

Espero haber podido explicar

Muchas gracias!

Envio tabla de ejemplo. 

 

PrimaryIdentityFarmNumberDateOfBirthEntryDateSoldDateFarrowingsCycleServiceXMatingDate  
394775204/04/201704/12/201720/05/2021891104/01/2021 04/01/2021
395075204/04/201704/12/201710/06/2021891125/01/2021 25/01/2021
399575207/04/201711/09/201727/05/2021781106/01/2021 06/01/2021
400875227/04/201709/10/201717/06/2021781125/01/2021 25/01/2021
402075227/04/201709/10/201710/06/2021781118/01/2021 18/01/2021
402575227/04/201709/10/201710/06/2021781121/01/2021 21/01/2021
403975206/07/201711/12/201710/06/2021781125/01/2021 25/01/2021
404075206/07/201711/12/201718/11/2021781102/02/2021 02/02/2021
404275206/07/201711/12/201708/07/2021781125/01/2021 25/01/2021
404275206/07/201711/12/201708/07/2021782120/02/2021->25/01/2021
405375206/07/201711/12/201722/02/2021671122/01/2021 22/01/2021 
405475206/07/201711/12/201710/06/2021671115/01/2021 15/01/2021
405475206/07/201711/12/201710/06/2021672107/02/2021->15/01/2021 
405975206/07/201711/12/201701/07/2021671108/02/2021 08/02/2021
406575206/07/201711/12/201722/07/2021671101/03/2021 01/03/2021
417493402/07/201729/11/201708/08/202210111310/03/2022 10/03/2022
418543403/07/201706/12/201726/07/202210111209/03/2022 09/03/2022
041731@13402/07/201729/11/201729/03/202210111309/03/2022 09/03/2022
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DBrito79 ,

I have created a simple sample , please refer to my pbix file to see if it helps you.

Create 2 measures.

Measure = var _1=CALCULATE(COUNT('Table'[PrimaryIdentity]),FILTER(ALL('Table'),'Table'[PrimaryIdentity]=SELECTEDVALUE('Table'[PrimaryIdentity])))
return 
IF(_1>1&&MAX('Table'[Service])>1,BLANK(),MAX('Table'[MatingDate]))
Measure 2 = MAXX(FILTER(ALL('Table'),'Table'[PrimaryIdentity]=SELECTEDVALUE('Table'[PrimaryIdentity])),[Measure])

 Or 2 columns.

Column = var _1=CALCULATE(COUNT('Table'[PrimaryIdentity]),FILTER('Table','Table'[PrimaryIdentity]=EARLIER('Table'[PrimaryIdentity])))
var _2=IF(_1>1&&'Table'[Service]>1,BLANK(),'Table'[MatingDate])
return _2
Column 2 = MAXX(FILTER('Table','Table'[PrimaryIdentity]=EARLIER('Table'[PrimaryIdentity])),'Table'[Column])

vrongtiepmsft_0-1688521553387.png

 

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 _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
DBrito79
Frequent Visitor

Hello!
Yes it works and helps a lot! And also helps for another similar formula that I need after.

Thank you very much. You are a genius! 

Best Regards

Diogo

Anonymous
Not applicable

Hi @DBrito79 ,

I have created a simple sample , please refer to my pbix file to see if it helps you.

Create 2 measures.

Measure = var _1=CALCULATE(COUNT('Table'[PrimaryIdentity]),FILTER(ALL('Table'),'Table'[PrimaryIdentity]=SELECTEDVALUE('Table'[PrimaryIdentity])))
return 
IF(_1>1&&MAX('Table'[Service])>1,BLANK(),MAX('Table'[MatingDate]))
Measure 2 = MAXX(FILTER(ALL('Table'),'Table'[PrimaryIdentity]=SELECTEDVALUE('Table'[PrimaryIdentity])),[Measure])

 Or 2 columns.

Column = var _1=CALCULATE(COUNT('Table'[PrimaryIdentity]),FILTER('Table','Table'[PrimaryIdentity]=EARLIER('Table'[PrimaryIdentity])))
var _2=IF(_1>1&&'Table'[Service]>1,BLANK(),'Table'[MatingDate])
return _2
Column 2 = MAXX(FILTER('Table','Table'[PrimaryIdentity]=EARLIER('Table'[PrimaryIdentity])),'Table'[Column])

vrongtiepmsft_0-1688521553387.png

 

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 _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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