Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Solle
Helper III
Helper III

Show future x months (slicer based) in bar chart

Hi all,

I am looking for some help to generate 3 button slicers that says "Future 3 Months" "Future 6 Months" and "Future 1 year" their purpose is to filter a barchart graph, which looks as below. 

Sampledata.JPG

I have tried multiple things, but nothing have seen to work out. 

Does anyone know how to create a dax filter, that allows to select those period - The periods should be based on today. There is data present for the future periods and there will always be, as this is future cashflows, as I am trying to generate a cashflow overview in PowerBI.

Let me know if you require anything else from me. 

Thank you!
Solle


1 ACCEPTED SOLUTION
random_Bi_User
Frequent Visitor

Hi @Solle
I would suggest @technolog solution aswell. You can create the bookmark and than use a button to switch between the bookmarks. Same thing can be archieved with the "navigation" button that automatically creates a button for each bookmark. The bookmark documentation can be found here: Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Docs


If you need to do this in dax you have three options:
1. The first one I would recommend if you want to do it in dax. This would give you a calculated column to filter on the number of months the date is in the future. So in this case 1 would be August (since its July), 2 is September and so on... 
The dax would look something like this:

if(DATEDIFF(TODAY(),'Datetable'[Date],MONTH)>0, DATEDIFF(TODAY(),'Datetable'[Date],MONTH),BLANK())


2. You could create a calculated coloumn in your date table to filter on the different time period. 
3. I would not recommend this, but you could create one column for each time period and filter on is in time period (yes/no). 

View solution in original post

4 REPLIES 4
random_Bi_User
Frequent Visitor

Hi @Solle
I would suggest @technolog solution aswell. You can create the bookmark and than use a button to switch between the bookmarks. Same thing can be archieved with the "navigation" button that automatically creates a button for each bookmark. The bookmark documentation can be found here: Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Docs


If you need to do this in dax you have three options:
1. The first one I would recommend if you want to do it in dax. This would give you a calculated column to filter on the number of months the date is in the future. So in this case 1 would be August (since its July), 2 is September and so on... 
The dax would look something like this:

if(DATEDIFF(TODAY(),'Datetable'[Date],MONTH)>0, DATEDIFF(TODAY(),'Datetable'[Date],MONTH),BLANK())


2. You could create a calculated coloumn in your date table to filter on the different time period. 
3. I would not recommend this, but you could create one column for each time period and filter on is in time period (yes/no). 

Hi @random_Bi_User 

Thank you for your reply - I will try to use your first step and then combine the filter with a bookmark 🙂 

Best Regards,
Solle

technolog
Super User
Super User

Hi @technolog 

Appreciate your reply! I think I will have to provide the above post as an answer. Despite partly using your recommendation as the solution! 

Thank you! 
Solle

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors