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
a-santiago
Frequent Visitor

Filter the last date of every year

Hi!

I would like to filter the column that is selected, to view the last date/month registered for each year with Dax.

asantiago_0-1670244654556.png

 

Thanks!


1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @a-santiago ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1671093998235.png

2.  add a new column with below dax formula

Last date of year =
VAR cur_date = [Date]
VAR cur_year =
    YEAR ( [Date] )
VAR tmp =
    FILTER ( 'Table', YEAR ( 'Table'[Date] ) = cur_year )
RETURN
    FORMAT ( MAXX ( tmp, [Date] ), "mmm yy" )

vbinbinyumsft_1-1671094082040.png

Palease refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

3 REPLIES 3
v-binbinyu-msft
Community Support
Community Support

Hi @a-santiago ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1671093998235.png

2.  add a new column with below dax formula

Last date of year =
VAR cur_date = [Date]
VAR cur_year =
    YEAR ( [Date] )
VAR tmp =
    FILTER ( 'Table', YEAR ( 'Table'[Date] ) = cur_year )
RETURN
    FORMAT ( MAXX ( tmp, [Date] ), "mmm yy" )

vbinbinyumsft_1-1671094082040.png

Palease refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@a-santiago , flag for the last date of the year

 

last date of year = if([Date] = eomonth([Date], 12- month([Date]) ) , 1,0)

hI!
This doesn't work:

asantiago_0-1670284998702.png
The column I want to filter is YTD_MONTH in SNAP table and its date type: mmm yy .
The filter just shows "0" -->

asantiago_1-1670285062505.png

Any more info I can provide?
Thanks!

 

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.