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:
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:
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.
Solved! Go to Solution.
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.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting
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.
If it helps, mark it as a solution
Kudos are nice too.
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
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.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingUser | Count |
---|---|
156 | |
96 | |
80 | |
70 | |
70 |