Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello everyone
I have different types of charts (line, bar, etc.). In all my charts the X-axis are months of the year, and I wanted to know if it is possible that the number of months that the graph shows can be dynamic, that is, that through a visual I can enter the number of months that I want to see and the graphs are filtered and only show the number of months that I have entered
Thanks for the reply, do you think you can help me understand it better with a visual aid than you indicate, please
Sure thing! Here is an axample using the RelativeMonthPos field that is in my date table.
Since we are in November, it is represented by 0. If I want to show November and the three months prior, I just set the slicer to -3 to 0. This option (IMO) gives you the most control.
I use the date table from SQLBI that I write about in this blog post (it also has a link where you can get the date table from SQLBI). http://powerbiwithme.com/2023/08/01/the-custom-date-table-edition/
You can also use a slicer with date and set the slicer setting to relative date. In this case, I set it to give me the last 4 calendar months, so it shows me the most recently closed 4 months:
If I do the last 4 months, it does exactly that - a partial month for this month and a partial month for Jul, because it is getting 4 months worth of data based on the actual date:
Proud to be a Super User! | |
You can use a relative date slicer and set it to is in the last X number of months where the user decides the number of months. Also, depending on the date table you have, if it has relative columns (like number of months difference relative to the month we are in), you could use that as a slicer/filter as well (i.e. if someone wants to see the current month and the 3 months prior they would select from -3 to 0).
Proud to be a Super User! | |
User | Count |
---|---|
85 | |
79 | |
64 | |
52 | |
46 |
User | Count |
---|---|
101 | |
44 | |
41 | |
39 | |
37 |