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
PavaniD
Helper I
Helper I

How to get MAX DATE for each account in the table

Hello Team,

Im creating a measure "GET_LIEN_STR_SA" it needs max date and conditions on few types and status. when I use MAX its just giving maximum date in that particular column keeping all other blank. I want max date for each record of account id .


 

Thanks in advance.

2 ACCEPTED SOLUTIONS
PijushRoy
Super User
Super User

Hi @PavaniD 

Can you please try DAX like the below (example only), please update the filter condition as per the requirement

 

CALCULATE(
    MAX('Table'[DateColumn]), 
    FILTER(
        'Table',
        'Table'[AccountID] = EARLIER('YourTable'[AccountID]) && 
        'Table'[Type] IN {"Type1", "Type2"} &&                   
        'Table'[Status] = "YourStatus"                           
    )
)

 

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

Thanks
Pijush
Linkedin

View solution in original post

v-xuxinyi-msft
Community Support
Community Support

Hi @PavaniD 

 

I ran the testing as follows.

 

My sample:

vxuxinyimsft_0-1708327709417.png

 

Measure:

 

GET_LIEN_STR_SA = CALCULATE(MAX([Date]), ALLEXCEPT('Table', 'Table'[ID], 'Table'[status]))

 

 

vxuxinyimsft_2-1708327942834.png

Is this the result you expect?

 

If I've misunderstood you, please provide detailed sample data and the results you are hoping for: How to provide sample data in the Power BI Forum - Microsoft Fabric Community . Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Yulia Xu

 

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
v-xuxinyi-msft
Community Support
Community Support

Hi @PavaniD 

 

I ran the testing as follows.

 

My sample:

vxuxinyimsft_0-1708327709417.png

 

Measure:

 

GET_LIEN_STR_SA = CALCULATE(MAX([Date]), ALLEXCEPT('Table', 'Table'[ID], 'Table'[status]))

 

 

vxuxinyimsft_2-1708327942834.png

Is this the result you expect?

 

If I've misunderstood you, please provide detailed sample data and the results you are hoping for: How to provide sample data in the Power BI Forum - Microsoft Fabric Community . Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Yulia Xu

 

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

PijushRoy
Super User
Super User

Hi @PavaniD 

Can you please try DAX like the below (example only), please update the filter condition as per the requirement

 

CALCULATE(
    MAX('Table'[DateColumn]), 
    FILTER(
        'Table',
        'Table'[AccountID] = EARLIER('YourTable'[AccountID]) && 
        'Table'[Type] IN {"Type1", "Type2"} &&                   
        'Table'[Status] = "YourStatus"                           
    )
)

 

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

Thanks
Pijush
Linkedin

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.