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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Anonymous
Not applicable

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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