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
ecroke
Frequent Visitor

Filter Drop down

Hi,

I am trying to recreate a column chart within Power Bi. The aspect I'm having trouble with is that I must put in a drop down box that lets you filter the chart into 5 different aspects.

1. Last 30 days,

2. This month in days,

3. last 30 weeks,

4. Last 12 months,

5. Last 8 Quarters.

Can someone recommend an easy way of obtaining this drop down box within Power bi Desktop please?

Thanks

 

2 ACCEPTED SOLUTIONS

hey i tried to create a sample for you, see pbix file here

 

https://drive.google.com/file/d/0B8z5lc1oML-hT3pfMVI1OE5QRFU/view?usp=sharing

 

Basically adding some measures in calendar table and then filtered on those measures. once you have your data table related to calendar table, i expect it will filter record based on your slicer. anyhow this is an idea, you can change/amend as you see fit.

 

Let me know how it goes. 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

v-sihou-msft
Employee
Employee

@ecroke

 

To filter the "Last X period" data, you can create a calculated table to include all "Last X periods" dates and add a column for tagging "Last X period". Then build the relationship to existing date table to filter corresponding dates. For more details, please refer to article below:

 

Power BI – Time Period Slicer for Last 7 Days,Last 30 Days..

 

Regards,

View solution in original post

10 REPLIES 10
Back2Basics
Helper IV
Helper IV

Hi ecroke

 

I'm new to this too but if it were me I would try to use a 'dynamic' column, or several columns to identify when they fall into those catergories.

 

For example (Last 30 days):

 

Last 30 days = if(Table_A[Date Field] > (Today()- 30), "Last 30 Days", "")

*This, as far as I am aware, should return "Last 30 Days" where the date in questio nis greater than today -30, and therefore should capture anything that falls into that. As the data increases or the data changes records will fall in or out of this so will be effectively 'LIVE'.

 

You might be able to do it all in one expression:

 

if(Table_A[Date Field] >(Today () -30), "Last 30 Days", if(Table_A[Date Field] >(Today() -(30*7)), "Last 30 Weeks", if(Table_A[Date Field] >(Today() -365), "last 12 Months", if(Table_A[Date Field] >(Today()-730), "last 8 Quarters", ""))))

 

I might be a bit naive about the caluations in there and there might be better ways of perfecting those - but hopefully you can see the idea behind my thinking here??

v-sihou-msft
Employee
Employee

@ecroke

 

To filter the "Last X period" data, you can create a calculated table to include all "Last X periods" dates and add a column for tagging "Last X period". Then build the relationship to existing date table to filter corresponding dates. For more details, please refer to article below:

 

Power BI – Time Period Slicer for Last 7 Days,Last 30 Days..

 

Regards,

Thanks@v-sihou-msft, I used another way of doing it but is always good to know different methods of completing it. Thanks you very much for your help.

Greg_Deckler
Super User
Super User

Can't think of anything off the top of my head. Any chance you can post some sample data so I can play around with the concept?

 

I wonder if you could create a column where you flagged those categories. The problem though is with overlapping buckets. Hmm...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Smoupre,

I have included some sample data above. I have filtered the data into the headings I would like. 

Thanks for your help

OK, I'm a little confused by your data. I was expecting to have a table with a list of dates and some kind of value that you are aggregating. Is that not the case? You just want to be able to filter dates into buckets??


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

chart.jpg

Sorry for the confusion, I'm trying to replicate this dashboard.

 

 

 

hey i tried to create a sample for you, see pbix file here

 

https://drive.google.com/file/d/0B8z5lc1oML-hT3pfMVI1OE5QRFU/view?usp=sharing

 

Basically adding some measures in calendar table and then filtered on those measures. once you have your data table related to calendar table, i expect it will filter record based on your slicer. anyhow this is an idea, you can change/amend as you see fit.

 

Let me know how it goes. 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k

 

Thanks for your help. This works perfectly for me. 

Master	Previous 30 Days	This Month	Previous 30 Weeks	Previous 12 Months	Previous 8 Quarters
25/04/2017	null	25/04/2017	null	null	null
24/04/2017	24/04/2017	24/04/2017	null	null	null
22/04/2017	22/04/2017	22/04/2017	22/04/2017	null	null
21/04/2017	21/04/2017	21/04/2017	21/04/2017	null	null
20/04/2017	20/04/2017	20/04/2017	20/04/2017	null	null
19/04/2017	19/04/2017	19/04/2017	19/04/2017	null	null
18/04/2017	18/04/2017	18/04/2017	18/04/2017	null	null
15/04/2017	15/04/2017	15/04/2017	15/04/2017	null	null
14/04/2017	14/04/2017	14/04/2017	14/04/2017	null	null
13/04/2017	13/04/2017	13/04/2017	13/04/2017	null	null
12/04/2017	12/04/2017	12/04/2017	12/04/2017	null	null
11/04/2017	11/04/2017	11/04/2017	11/04/2017	null	null
10/04/2017	10/04/2017	10/04/2017	10/04/2017	null	null
09/04/2017	09/04/2017	09/04/2017	09/04/2017	null	null
08/04/2017	08/04/2017	08/04/2017	08/04/2017	null	null
07/04/2017	07/04/2017	07/04/2017	07/04/2017	null	null
06/04/2017	06/04/2017	06/04/2017	06/04/2017	null	null
05/04/2017	05/04/2017	05/04/2017	05/04/2017	null	null
04/04/2017	04/04/2017	04/04/2017	04/04/2017	null	null
03/04/2017	03/04/2017	03/04/2017	03/04/2017	null	null

 

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