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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Rajendrabobade
Helper II
Helper II

Dynamic column name when selecting filter

Hi ,

I need help ,  whne i select filter on year then my column header name sholud be same as filter selection.

 

eg:I am creating volume measure calculated column  for curret year and previous year , whnever i am select year my column name need to automtically chnage as selcetd in filter.

when i select year filter -FY 20 need same as below , i want same for other year selction as well .

if i slecet FY 19 then prvious year column name change automtically to FY 18.

 

 

category typeFY 19 FY 20 
 previous yearcurrnt year
A3344
B4564655

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Rajendrabobade ,

 

1.My sample data is this.

DateSalescategory type

1/1/20201A
5/5/20202A
3/3/20203A
4/4/20206A
6/6/20205A
5/7/20194A
4/6/20191A
7/7/20192A
1/1/20193A
7/7/20186A
5/5/20184A
9/9/20188A
7/7/20187A
8/4/20177A
7/7/20179A
1/1/20179A
5/5/20176A
6/6/20171A
1/1/20201B
5/5/20205B
3/3/20204B
4/4/20207B
6/6/20208B
5/7/20199B
4/6/20196B
7/7/20195B
1/1/20191B
7/7/20182B
5/5/20183B
9/9/20186B
7/7/20184B
8/4/20171B
7/7/20175B
1/1/20174B
5/5/20177B
6/6/20171B

 

2.Create a fiscal calendar, starting with May of each year.

Calendar =
ADDCOLUMNS (
    CALENDARAUTO ( 4 ),
    "Fiscal year",
        VAR fy =
            IF (
                MONTH ( [Date] ) <= 4,
                VALUE ( FORMAT ( [Date], "YY" ) ) - 1,
                VALUE ( FORMAT ( [Date], "YY" ) )
            )
        RETURN
            CONCATENATE ( "FY ", fy )
)

2.png

 

3.Create a Fiscal year table by entering data.

3.png

 

4.The relationships are as follows.

4.png

 

5.Create a measure to filter the current year and the previous year.

Measure = 
VAR _year =
    SELECTEDVALUE ( 'Fiscal year'[FY] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER (
            'Calendar',
            [Fiscal year] = _year
                || [Fiscal year]
                    = "FY "
                        & RIGHT ( _year, 2 ) - 1
        )
    )
v

 

6.Put the measure into the Values of the matrix. The result is this.

result YEAR.gif

 

 

You can check more details from here.

 

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

1 REPLY 1
Anonymous
Not applicable

Hi @Rajendrabobade ,

 

1.My sample data is this.

DateSalescategory type

1/1/20201A
5/5/20202A
3/3/20203A
4/4/20206A
6/6/20205A
5/7/20194A
4/6/20191A
7/7/20192A
1/1/20193A
7/7/20186A
5/5/20184A
9/9/20188A
7/7/20187A
8/4/20177A
7/7/20179A
1/1/20179A
5/5/20176A
6/6/20171A
1/1/20201B
5/5/20205B
3/3/20204B
4/4/20207B
6/6/20208B
5/7/20199B
4/6/20196B
7/7/20195B
1/1/20191B
7/7/20182B
5/5/20183B
9/9/20186B
7/7/20184B
8/4/20171B
7/7/20175B
1/1/20174B
5/5/20177B
6/6/20171B

 

2.Create a fiscal calendar, starting with May of each year.

Calendar =
ADDCOLUMNS (
    CALENDARAUTO ( 4 ),
    "Fiscal year",
        VAR fy =
            IF (
                MONTH ( [Date] ) <= 4,
                VALUE ( FORMAT ( [Date], "YY" ) ) - 1,
                VALUE ( FORMAT ( [Date], "YY" ) )
            )
        RETURN
            CONCATENATE ( "FY ", fy )
)

2.png

 

3.Create a Fiscal year table by entering data.

3.png

 

4.The relationships are as follows.

4.png

 

5.Create a measure to filter the current year and the previous year.

Measure = 
VAR _year =
    SELECTEDVALUE ( 'Fiscal year'[FY] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER (
            'Calendar',
            [Fiscal year] = _year
                || [Fiscal year]
                    = "FY "
                        & RIGHT ( _year, 2 ) - 1
        )
    )
v

 

6.Put the measure into the Values of the matrix. The result is this.

result YEAR.gif

 

 

You can check more details from here.

 

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.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.