Forum Discussion
Dynamic Chart Title Based on Fiscal Hierarchy Level in Stacked Column Chart
I am using a stacked column chart in Power BI where the X-axis contains a fiscal hierarchy with three levels: Fiscal Year, Fiscal Quarter, and Fiscal Month. This hierarchy is text-based.
In the Y-axis, I am using a DAX measure for Customer Count. I want to create a dynamic chart title that reflects the hierarchy level currently in view, such as:
• “# Customers by Fiscal Year”
• “# Customers by Fiscal Quarter”
• “# Customers by Fiscal Month”
I do not want to rename the DAX measure to “# Customers”.
I have already tried using the ISINSCOPE, HASONEVALUE, and ISFILTERED functions, but I am still unable to achieve the desired result. The title either remains static or does not correctly reflect the hierarchy level.
Has anyone encountered a similar issue or found a reliable way to dynamically update the chart title based on the visible hierarchy level?
Thanks in advance for your help!
15 Replies
- MayflyAnalyticsNew Member
Have you tried using ISINSCOPE in conjuction with SWITCH? See below:
Dynamic Title = SWITCH( TRUE(), ISINSCOPE('Calendar'[FiscalMonth]), "# Customers by Fiscal Month", ISINSCOPE('Calendar'[FiscalQuarter]), "# Customers by Fiscal Quarter", ISINSCOPE('Calendar'[FiscalYear]), "# Customers by Fiscal Year", "# Customers" )- AniGaikwadRegular Visitor
I have tried this , still getting only '# Customers' in every hierarchy level
SWITCH(TRUE(),
ISINSCOPE('Date'[Week]), "# Customers by Week",ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
- Nasif_Azam
Super User
Hey AniGaikwad ,
Yes, you can create a dynamic chart title based on the currently visible level of a fiscal hierarchy (Fiscal Year, Fiscal Quarter, Fiscal Month) in a stacked column chart using DAX in Power BI. Since you’re working with a text-based hierarchy and have tried common functions like ISINSCOPE, HASONEVALUE, and ISFILTERED, here’s a refined solution tailored for your scenario.
Solution
1. Understand ISINSCOPE for Hierarchies
The ISINSCOPE() function works best for identifying the deepest level visible in a hierarchy. You need to check the levels from deepest (Fiscal Month) to highest (Fiscal Year) in reverse order because Power BI evaluates all visible levels.
2. Create the Dynamic Title Measure
Chart Title =
SWITCH(
TRUE(),
ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
Replace 'Date' with the name of your date table and ensure [Fiscal Month], [Fiscal Quarter], and [Fiscal Year] are the exact column names used in your hierarchy.
3. Use the Title in the Chart
- Select the stacked column chart.
- Go to the Format pane → Title → Turn it On.
- In the fx button (conditional formatting), bind the title to the Chart Title measure.
Why This Works
- ISINSCOPE('Date'[Fiscal Month]) returns TRUE only when that level is active (i.e., visible as the granularity on the X-axis).
- The order of conditions matters: check Month → Quarter → Year, as multiple levels may be in scope simultaneously depending on drill behavior.
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam - maruthisp
Super User
Hi AniGaikwad
As per Nasif_Azam and MayflyAnalytics , SWITCH and ISINSCOPE helps to achieve what youa re looking for.
Dynamic Chart Title =
SWITCH(
TRUE(),
ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
1.ISINSCOPE() checks if a specific column is currently being used in the visual’s axis.
2.The order matters: it checks from most granular (Month) to least (Year).
3.SWITCH(TRUE(), ...) is a clean way to evaluate multiple conditions.4.Please let me know if you have further questions.
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks!
Best Regards,
Maruthi
- AniGaikwadRegular Visitor
I have tried this , still getting only '# Customers' in every hierarchy level
SWITCH(TRUE(),
ISINSCOPE('Date'[Week]), "# Customers by Week",ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
- AniGaikwadRegular Visitor
I have tried this , still getting only '# Customers' in every hierarchy level
SWITCH(TRUE(),
ISINSCOPE('Date'[Week]), "# Customers by Week",ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
- pankajnamekar25
Super User
Hello AniGaikwad
Try this measure
Dynamic Chart Title =
SWITCH(
TRUE(),
ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
- AniGaikwadRegular Visitor
I have tried this , still getting only '# Customers' in every hierarchy level
SWITCH(TRUE(),
ISINSCOPE('Date'[Week]), "# Customers by Week",ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
- danextian
Super User
Hi AniGaikwad
When expanding the hierarchy, none of the approaches provided earlier will work because the title has no row context and cannot determine if a lower hierarchy level is expanded or not. In a drill-down scenario, a conditional measure that checks whether a lower-level hierarchy is in scope should be used. This condition must start by evaluating the lowest hierarchy level first.
- AniGaikwadRegular Visitor
I have tried this , still getting only '# Customers' in every hierarchy level
SWITCH(TRUE(),
ISINSCOPE('Date'[Week]), "# Customers by Week",ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
- AnonymousNot applicable
Hi AniGaikwad,
Please ensure that you're using a proper hierarchy field in the X-axis (created in the Fields pane) rather than adding separate fields manually. Dynamic titles using ISINSCOPE only work correctly when a true hierarchy is used in the visual.
Regards,
Vinay Pabbu
- AniGaikwadRegular Visitor
I have tried this , still getting only '# Customers' in every hierarchy level
SWITCH(TRUE(),
ISINSCOPE('Date'[Week]), "# Customers by Week",ISINSCOPE('Date'[Fiscal Month]), "# Customers by Fiscal Month",
ISINSCOPE('Date'[Fiscal Quarter]), "# Customers by Fiscal Quarter",
ISINSCOPE('Date'[Fiscal Year]), "# Customers by Fiscal Year",
"# Customers"
)
- AnonymousNot applicable
Hi AniGaikwad,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Vinay Pabbu- AnonymousNot applicable
Hi AniGaikwad,
I just wanted to follow up on your thread. If the issue is resolved, it would be great if you could mark the solution so other community members facing similar issues can benefit too.
If not, don’t hesitate to reach out, we’re happy to keep working with you on this.Regards,
Vinay Pabbu
- AnonymousNot applicable
Hello AniGaikwad,
Just wanted to drop a quick note, were you able to resolve the issue you raised?
If so, it would be really helpful for the community if you could mark the answer that helped you the most. If you're still looking for guidance, feel free to give us an update, we’re here for you!Regards,
Vinay Pabbu