The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi,
I'm working on a report where I want to dynamically change both the time frame logic and the X-axis granularity based on a user-selected period from a slicer. Link to the file: Sample
I have a slicer with the following period options (from a disconnected table PeriodTable[Period]):
MTD vs. Last Year MTD → show by days
QTD vs. Last Year QTD → show by weeks
Current YTD vs. Prior YTD → show by weeks
Rolling 90 days → show by weeks
Rolling 12 Months → show by months
My goal is to:
Use one line chart that dynamically adapts its X-axis to show the right level of date granularity based on the selected period
Display two measures:
Current Period (CurrentPeriod)
Same Period Last Year (SamePeriodLastYear)
Use a dynamic table (Date_Period) for the axis, which adjusts to day/week/month with proper labels and sorting
Hi @BJankic ,
May I know if your issue has been resolved, or are you still facing any difficulties? If you need any additional information, please feel free to let us know.
Thank You.
Hi @V-yubandi-msft , no, it’s not. If you could share a working example or add it to the sample I shared, that would really help. Thank you!"
Hi @BJankic ,
If your issue is resolved, that's good. If you need any further assistance or additional details, feel free to let me know.
Thank you.
Hi @V-yubandi-msft,
The issue still isn’t resolved. There has to be a way to handle this with parameters and switch the X-axis to different date views, right?
Hi @BJankic ,
You're correct this can be done in Power BI using Field Parameters. Although Power BI doesn't let you change the X-axis granularity directly with a slicer, you can use Field Parameters to switch between different date fields such as Day, Week, or Month, depending on your selection. This way, you can dynamically adjust the X-axis in a single visual.
Helpful Reference: Use report readers to change visuals - Power BI | Microsoft Learn
Thank You.
Before I begin updating your file, I want to clarify your expectations. When you mention switch the X-axis to different date views, are you looking for it to automatically change between day, week, and month based only on the Period slicer selection? Or is it acceptable for the user to use a separate Field Parameter slicer to control the view?
Thank You.
Hi @V-yubandi-msft ,
Yes, one slicer, to automatically change between day, week, and month based only on the Period slicer selection.
Thank you!
Thanks again for sticking with me through this. I’ve now set up the report to work just the way you described.
You can use the Period slicer to control both the time logic and the X axis granularity. Behind the scenes, I’ve used bookmarks to switch between different visuals (day, week, month) depending on what’s selected. So even though Power BI doesn’t let us change the axis directly from a slicer, this setup gives you a smooth, dynamic experience all from one control.
Each chart shows the right comparison between the current period and the same period last year, and updates automatically based on your selection.
Please check attached .PBIX file for more details.
Best,
Yugandhar.
Could you let us know if your issue has been resolved or if you are still experiencing difficulties? Your feedback is valuable to the community and can help others facing similar problems.
Thank You.
Hi @V-yubandi-msft ,
Thank you for your effort, but this isn’t quite what I was expecting. First, I wanted to avoid using bookmarks. Second, you can see that it’s not performing as expected, for the rolling 12 months, it should be comparing periods rather than showing them all in a single line chart. The same applies to the other timeframes as well.
Best regards,
Bojan
Hi @BJankic ,
Thank you for clarifying. I understand you're aiming for a dynamic date axis that updates based on the selected period, without relying on bookmarks.
Currently, Power BI doesn't provide a direct way to change axis behavior dynamically via slicer input. While bookmarks are a flexible workaround, I see you prefer not to use them.
We can look into alternative methods, such as adjusting calculations to simulate dynamic behavior. This approach may not fully replicate true axis switching, but it could be a close alternative.
if you're open to revisiting bookmarks in a limited way happy to help tailor something that fits your workflow.
Regards,
Yugandhar.
Hi @V-yubandi-msft,
Thanks for clarifying. Let’s try the calculation based approach.
Best regards,
Bojan
Hi @BJankic ,
Thank you for your patience. I’ve reviewed the solution and made some updates it’s now functioning properly without bookmarks. I hope this aligns with your needs.
When you have a chance, please review the attached PBIX file and let me know if it works for you or if any further changes are required.
Best regards,
Yugandhar.
Hi @V-yubandi-msft ,
Thank you for your effort, but unfortunately it is not working properly.
First thing X axis should show like this (days, weeks, months) for selected period :
MTD vs. Last Year MTD → show by days
QTD vs. Last Year QTD → show by weeks
Current YTD vs. Prior YTD → show by weeks
Rolling 90 days → show by weeks
Rolling 12 Months → show by months
Second, you have overlaps in terms of the years in the view and time frame is staying the same.
Thank you for staying engaged and sharing your concerns.
I understand that this issue might require a more detailed, hands-on approach. While we've covered several possible solutions, I recommend reaching out to a certified Power BI partner for support tailored to your specific needs.
Power BI Partners – Power BI Partners | Microsoft Power Platform
Hi @BJankic ,
I wanted to follow up to see if you were able to reach out to the Power BI partner community we recommended earlier. If you have any updates or responses, please share them here, as they may benefit other community members.
Regards,
Yugandhar
I tried using calculation groups, but they didn’t work as expected. It seems bookmarks are the better option, so I’ll set that up and share it with you once it’s ready.
Thanks for your patience.
Hi @V-yubandi-msft ,
Thank you for your effort, but this isn’t quite what I was expecting. First, I wanted to avoid using bookmarks. Second, you can see that it’s not performing as expected, for the rolling 12 months, it should be comparing periods rather than showing them all in a single line chart. The same applies to the other timeframes as well.
Best regards,
Bojan
Hi @BJankic ,
Thank you for reaching out to the Fabric Community. I noticed that your sample file needs access permissions, so I couldn’t view your data directly. To assist, I recreated your situation with sample data and was able to achieve the dynamic time frame and axis granularity you mentioned.
I’ve attached a PBIX file for your reference. Please take a look and let me know if you need any changes. I’m happy to help further.
Best regards,
Yugandhar.
User | Count |
---|---|
65 | |
62 | |
60 | |
53 | |
28 |
User | Count |
---|---|
181 | |
82 | |
67 | |
47 | |
44 |