Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi Friends,
Is it possible to add year in column name?
So it change dynamically based on the year selection.
If I select 2021, prev year column show 2020,
If I select 2020, prev year column show 2019.
Solved! Go to Solution.
Hi,
It's possible to do it.
I've done it already.
CURPREV_YEAR =
VAR Sales = CALCULATE([TOTAL_QTY],DATETABLE[YEAR] = SELECTEDVALUE('YEAR'[YEAR]))
return
IF(
SELECTEDVALUE('YEAR'[YEAR]) IN {MAX(DATETABLE[YEAR]),MAX(DATETABLE[YEAR])-1},Sales,BLANK()
)
There are probably a few different ways to solve this.
Just need some extra detail.
If I was to select 2021 from the slicer, are you only wanting to see 2020, or do you expect to see everything AFTER 2020?
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
Hi,
It's possible to do it.
I've done it already.
CURPREV_YEAR =
VAR Sales = CALCULATE([TOTAL_QTY],DATETABLE[YEAR] = SELECTEDVALUE('YEAR'[YEAR]))
return
IF(
SELECTEDVALUE('YEAR'[YEAR]) IN {MAX(DATETABLE[YEAR]),MAX(DATETABLE[YEAR])-1},Sales,BLANK()
)
As far as I know, Changing the field name dynamically feature is not available.
Hi,
It's possible to do it.
I've done it already.
CURPREV_YEAR =
VAR Sales = CALCULATE([TOTAL_QTY],DATETABLE[YEAR] = SELECTEDVALUE('YEAR'[YEAR]))
return
IF(
SELECTEDVALUE('YEAR'[YEAR]) IN {MAX(DATETABLE[YEAR]),MAX(DATETABLE[YEAR])-1},Sales,BLANK()
)
Add a new measure with the code below?
PreviousYear = SELECTEDVALUE(TableName[Year])+1
Hi FreemanZ,
This is not what I want.
I mean I want to have dynamics year based on my selection.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 58 | |
| 53 | |
| 40 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 114 | |
| 107 | |
| 41 | |
| 34 | |
| 25 |