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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
AlanP514
Post Patron
Post Patron

Dynamic Calendar year

Hai all, I have created a calendar table by using this Dax

AlanP514_0-1664429422834.png

Here I want to show the "This year" text in the year field 
The requirement is I have a slicer like this it will show this text every year dynamically (ie. If the current year is 2022 = the YEAR Column should show " this year", if it is 2023 it should show "this year "), Down I am attaching the Dax  whichever I used in power bi as the master calendar

AlanP514_1-1664429533215.png

Dim_Calendar =
var _FromDate= MIN ( 'Fact_'[Month Start Date])
var _ToDate= Max ( 'Fact_'[Month Start Date])

var _Today=TODAY()

return
ADDCOLUMNS(
    CALENDAR(_FromDate,_ToDate)
    ,"Year",YEAR([Date])
    ,"Year Start Date",DATE( YEAR([Date]),1,1)
    ,"Year End Date",DATE( YEAR([Date]),12,31)

    ,"Quarter",QUARTER([Date])
    ,"Quarter Name","Q"&FORMAT([Date],"Q")
    ,"Quarter Start Date",DATE( YEAR([Date]), (QUARTER([Date])*3)-2, 1)
    ,"Quarter End Date",EOMONTH(DATE( YEAR([Date]), QUARTER([Date])*3, 1),0)    
    ,"Year Quarter Number",COMBINEVALUES("-",YEAR([Date]),FORMAT( QUARTER([Date]),"00"))

    ,"Month",MONTH([Date])
    ,"Month Name",FORMAT([Date],"MMMM")
    ,"Month Name Short",FORMAT([Date],"MMM")
    ,"Month Start Date",DATE( YEAR([Date]), MONTH([Date]), 1)
    ,"Month End Date",EOMONTH([Date],0)
    ,"Year Month Number",FORMAT([Date],"YYYY-MM")
    ,"Year Month Name",FORMAT([Date],"YYYY-MMM")


Help me to achieve this logic


Thanks 
Alan
1 ACCEPTED SOLUTION
HoangHugo
Solution Specialist
Solution Specialist

Hi

Can not catch you almost, I understand you want to replace the number of current year by text "this year".

If so, just need creat a new column of year

Year_2 = if([YEAR column] = YEAR(TODAY()),"This Year",[YEAR column])

 

then put Year_2 into slicer.

View solution in original post

1 REPLY 1
HoangHugo
Solution Specialist
Solution Specialist

Hi

Can not catch you almost, I understand you want to replace the number of current year by text "this year".

If so, just need creat a new column of year

Year_2 = if([YEAR column] = YEAR(TODAY()),"This Year",[YEAR column])

 

then put Year_2 into slicer.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.