cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
willpage
Helper II
Helper II

Slider Control in a Slicer for Text Columns?

I have a data source that contains sales data per month. The table has a column called Year, which is a numeric year, and it also has both Month of Sale in Text, the full word for the month, e.g January, and also the numeric month number as an integer.

 

I need to create a report that allows the operator to see the sum of sales data across an arbitrary, user selectable range of dates, e.g. February 2017 to July 2018.

 

To this end, I created a column called Sortable Date in Power Query using the following formula, and changed its type to whole number:

 

Text.From([Year]) & Text.PadStart(Text.From([Month Number]),2,"0")

 

When I add this column to a slicer I get the slider control I need, all good. Except that it's not that human friendly:

image.png

 

So, next thing I did was create a new column called Friendly Date with this formula:

 

[Month of Sale] & " " & Text.From([Year])

 

Back in the report, I sorted this column by Sortable Date, but I just get a massive list of check boxes when used in a slicer:

image.png

 

Is there a way I can make it so I get the slider control as per sortable date, but with the friendly labels as per the Friendly date?

 

I need to only allow a range of dates, or a single month to be selected. It won't do for a user to be able to select a bunch of random non-contiguous months.

 

Any help greatly appreciated.

2 ACCEPTED SOLUTIONS
edhans
Super User
Super User

You should create a Date table and relate the date table to your data table. You can create an arbitrary date in your data table if you don't have the day. Use the first day of the month, or last day, or 15th, or whatever.

 

Then create whatever columns you want in the date table and use that as your slicer control. It will filter down to your data table. You can read more about date tables here, and I prefer to create dynamic date tables in Power Query so they are always complete, no matter how much new data gets added to your data set over time.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

VasTg
Memorable Member
Memorable Member

@willpage 

 

As far as i know, what you are asking is not there. Maybe change it to a date so that atleast the users can see a calender to pick a date.

image.png

 

If it helps, mark it as a solution

Kudos are nice too.

 

Connect on LinkedIn

View solution in original post

3 REPLIES 3
Himanshu51096
Regular Visitor

I also want a slider with two drop down like start date and end date and my column is in text format (2021 PD 04 ) please post A solution

VasTg
Memorable Member
Memorable Member

@willpage 

 

As far as i know, what you are asking is not there. Maybe change it to a date so that atleast the users can see a calender to pick a date.

image.png

 

If it helps, mark it as a solution

Kudos are nice too.

 

Connect on LinkedIn
edhans
Super User
Super User

You should create a Date table and relate the date table to your data table. You can create an arbitrary date in your data table if you don't have the day. Use the first day of the month, or last day, or 15th, or whatever.

 

Then create whatever columns you want in the date table and use that as your slicer control. It will filter down to your data table. You can read more about date tables here, and I prefer to create dynamic date tables in Power Query so they are always complete, no matter how much new data gets added to your data set over time.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors