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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Last date dax

Hi experts,

I want to filter records based on the date filed dynamically , when the user will select any of the month, then I want to show the data accordingly.

Please help

 

Date                   Type        Value

20-06-2018          A             20

20-06-2018          B             40

19-06-2018          A             21

19-06-2018          B             39

 

Output on Visual:

Date                  Type          Value

20-06-2018          A             20

20-06-2018          B             40

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

You can create a measure formula to get the last date based on group and compare with current row date to return flag, then you can use this on ‘visual level filter’ to filter records:

formula =
VAR _lastdate =
    CALCULATE ( MAX ( Table[Date] ), ALLSELECTED ( Table ), VALUES ( Table[Type] ) )
VAR currdate =
    MAX ( Table[Date] )
RETURN
    IF ( currdate = _lastdate, "Y", "N" )

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table.  Drag Type to the Table/matrix visual.  Write these measures

Last date = max(Data[Date])

Amount = calculate(sum(Data[Sales]),datesbetween(Calendar[Date],[last date],[last date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

HI @Anonymous,

You can create a measure formula to get the last date based on group and compare with current row date to return flag, then you can use this on ‘visual level filter’ to filter records:

formula =
VAR _lastdate =
    CALCULATE ( MAX ( Table[Date] ), ALLSELECTED ( Table ), VALUES ( Table[Type] ) )
VAR currdate =
    MAX ( Table[Date] )
RETURN
    IF ( currdate = _lastdate, "Y", "N" )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors