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
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
v-stephen-msft
Community Support
Community Support

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
v-stephen-msft
Community Support
Community Support

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
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.