Forum Discussion
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 type | FY 19 | FY 20 |
| previous year | currnt year | |
| A | 33 | 44 |
| B | 4564 | 655 |
- Anonymous5 years ago
Hi Rajendrabobade ,
1.My sample data is this.
DateSalescategory type
1/1/2020 1 A 5/5/2020 2 A 3/3/2020 3 A 4/4/2020 6 A 6/6/2020 5 A 5/7/2019 4 A 4/6/2019 1 A 7/7/2019 2 A 1/1/2019 3 A 7/7/2018 6 A 5/5/2018 4 A 9/9/2018 8 A 7/7/2018 7 A 8/4/2017 7 A 7/7/2017 9 A 1/1/2017 9 A 5/5/2017 6 A 6/6/2017 1 A 1/1/2020 1 B 5/5/2020 5 B 3/3/2020 4 B 4/4/2020 7 B 6/6/2020 8 B 5/7/2019 9 B 4/6/2019 6 B 7/7/2019 5 B 1/1/2019 1 B 7/7/2018 2 B 5/5/2018 3 B 9/9/2018 6 B 7/7/2018 4 B 8/4/2017 1 B 7/7/2017 5 B 1/1/2017 4 B 5/5/2017 7 B 6/6/2017 1 B 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 ) )3.Create a Fiscal year table by entering data.
4.The relationships are as follows.
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 ) ) v6.Put the measure into the Values of the matrix. The result is this.
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.
1 Reply
- AnonymousNot applicable
Hi Rajendrabobade ,
1.My sample data is this.
DateSalescategory type
1/1/2020 1 A 5/5/2020 2 A 3/3/2020 3 A 4/4/2020 6 A 6/6/2020 5 A 5/7/2019 4 A 4/6/2019 1 A 7/7/2019 2 A 1/1/2019 3 A 7/7/2018 6 A 5/5/2018 4 A 9/9/2018 8 A 7/7/2018 7 A 8/4/2017 7 A 7/7/2017 9 A 1/1/2017 9 A 5/5/2017 6 A 6/6/2017 1 A 1/1/2020 1 B 5/5/2020 5 B 3/3/2020 4 B 4/4/2020 7 B 6/6/2020 8 B 5/7/2019 9 B 4/6/2019 6 B 7/7/2019 5 B 1/1/2019 1 B 7/7/2018 2 B 5/5/2018 3 B 9/9/2018 6 B 7/7/2018 4 B 8/4/2017 1 B 7/7/2017 5 B 1/1/2017 4 B 5/5/2017 7 B 6/6/2017 1 B 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 ) )3.Create a Fiscal year table by entering data.
4.The relationships are as follows.
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 ) ) v6.Put the measure into the Values of the matrix. The result is this.
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.