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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Take max from set of dates based on date slicer in power bi

Hi,

 

I need to to get the max "as of date" from the below dataset with below conditon.

 

The lastest "as of date" date should be less than or equal to the selected date in the slicer and within a same deal_ID. So for each deal_ID, I will have a "MAX as of date".

 

Here is the sample data:

deal_idvaluesas of dateDesired output
1234 30 September 202231 August 2022
12341900031 August 202231 August 2022
12342000031 July 202231 August 2022
1235 30 June 202231 May 2022
12353000031 May 202231 May 2022
12354000030 April 202231 May 2022
1235 31 March 202231 May 2022
12362300028 February 202228 February 2022
12362100031 January 202228 February 2022

So as per the above data -

if I select

Date Slicer: 30-Sep-2022

Deal ID Slicer: 1234

my output should be: 31 August 2022

 

if I select

Date Slicer: 31-May-2022

Deal ID Slicer: 1235

my output should be: 31 May 2022

 

So, basically I need to have first non blank max date "as of date" is less than or equal to the slicer date within a same deal id.

 

Thanks,

RC

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Probably you need this calculated column:

 

Desired output = MAXX(FILTER('Table',[deal_id]=EARLIER('Table'[deal_id])&&[values]<>BLANK()),[as of date])

vstephenmsft_0-1664789410626.png

 

 

Best Regards,

Stephen Tao

 

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
Anonymous
Not applicable

Hi @Anonymous ,

 

Probably you need this calculated column:

 

Desired output = MAXX(FILTER('Table',[deal_id]=EARLIER('Table'[deal_id])&&[values]<>BLANK()),[as of date])

vstephenmsft_0-1664789410626.png

 

 

Best Regards,

Stephen Tao

 

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

 

jgeddes
Super User
Super User

 Try the measure 

 

Output =
var _selectedDate =
SELECTEDVALUE('Table (5)'[as of date])
var _dealID =
LOOKUPVALUE('Table (5)'[deal_id],'Table (5)'[as of date],_selectedDate)
Return  
CALCULATE(
    MAX('Table (5)'[as of date]),
    FILTER(ALL('Table (5)'), 'Table (5)'[deal_id] = _dealID && NOT(ISBLANK('Table (5)'[values])))
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.