Forum Discussion
Dynamic Slicer – Show Fiscal Year for INR Country and Calendar Year for Others
Hi Experts,
I have a requirement to dynamically customize my date slicer based on country selection.
Scenario:
If the user selects INR (India) as the Country →
The slicer should display Fiscal Year (Apr–Mar).If the user selects any other country →
The slicer should display Normal Calendar Year (Jan–Dec).
2 Replies
- Juan-Power-bi
Super User
Hi! Great requirement — this is totally doable in Power BI without any custom visual. The trick is to build both year types into your Calendar table and then use a calculated column to expose the right label based on a country slicer selection. Here's how I'd approach it:
Step 1 — Add both year columns to your Calendar table
daxFiscal Year =
"FY" & IF(MONTH('Calendar'[Date]) >= 4, YEAR('Calendar'[Date]), YEAR('Calendar'[Date]) - 1)
& "-" & RIGHT(TEXT(IF(MONTH('Calendar'[Date]) >= 4, YEAR('Calendar'[Date]) + 1, YEAR('Calendar'[Date])), "0000"), 2)
-- e.g. FY2024-25Calendar Year = YEAR('Calendar'[Date])
Step 2 — Create a dynamic "Year Label" measure that reacts to the country slicer
daxYear Label =
VAR SelectedCountry = SELECTEDVALUE(Country[Country], "ALL")
RETURN
IF(
SelectedCountry = "INR",
SELECTEDVALUE('Calendar'[Fiscal Year]),
SELECTEDVALUE('Calendar'[Calendar Year])
)
Step 3 — Build the slicer
Since slicers need a column (not a measure), the cleanest approach is to add a combined column to your Calendar table in Power Query or as a calculated column:
daxYear Display =
IF(
RELATED(Country[Country]) = "INR",
'Calendar'[Fiscal Year],
FORMAT('Calendar'[Calendar Year], "0")
)
Then use Year Display as your slicer field. When the user picks INR from the country slicer, cross-filtering will surface only the fiscal year labels; for any other country, the calendar year labels appear.
One important thing to keep in mind — Power BI slicers filter by values, so if you have both fiscal and calendar years in the same column, make sure the sort order column is set correctly so they display chronologically and not alphabetically.
Hope that help - cengizhanarslan
Super User
STEP 1) Create Required Columns in Date Table
Calendar Year column:
Calendar Year = YEAR('Date'[Date])Fiscal Year column (Apr–Mar):
Fiscal Year = YEAR(EDATE('Date'[Date], -3))Optional Fiscal Label:
Fiscal Year Label = "FY" & FORMAT([Fiscal Year], "0000")STEP 2) Create Two Separate Slicers
-
Calendar Year slicer
Field: Date[Calendar Year]
Rename in Selection Pane: Slicer_Calendar -
Fiscal Year slicer
Field: Date[Fiscal Year Label]
Rename in Selection Pane: Slicer_Fiscal
Place both slicers in the same location (stacked on top of each other).
STEP 3) Create Bookmarks
Go to View → Selection Pane
Go to View → Bookmarks PaneCreate Bookmark 1:
• Show Slicer_Calendar
• Hide Slicer_Fiscal
• Add Bookmark
• Name: Calendar View
• Uncheck "Data"
• Keep only Display checkedCreate Bookmark 2:
• Show Slicer_Fiscal
• Hide Slicer_Calendar
• Add Bookmark
• Name: Fiscal View
• Uncheck "Data"
• Keep only Display checkedSTEP 4) Add Buttons to Toggle
-
Insert → Buttons → Navigator → Bookmark Navigator
-
In Format pane:
Select only these two bookmarks:-
Calendar View
-
Fiscal View
-
-
Style it as Tabs or Buttons
-