Forum Discussion
Slicer - Date and Time
Hello,
I've created a cube using visual studio and I am trying to get reports with Power BI. I need to have specific times frames for my report. The only options I saw on Power BI are slicers. Do you know how to have a specific time frame? (I prefer using connect live option but if the answer requires me to use import option and create columns that's fine too).
Thank you,
Majid
Hi majidht,
I can reproduce your scenario, I get date from SSAS with inport mode as follows.
First, I can change the Text to Date type using the Formatting feature, please see the following screenshot.
Second, If you can not change the data type directly, you can split the date column to year, month, day column in Power Query Editor. Please select Split Column under on Query Editor Home, click appropriate delimiter.
When you get year, mon, day. If Month column is January format, you can use the following formula to change it to number.SWITCH([Month], "January", 1,"February", 2, "March",3, "April",4 , "May", 5,"June", 6, "July", 7, "August",8 , "September",9, "October", 10, "November",11, "December" 12 , 0 )
Then you can use DATE function to create calculated column to get Date column.Date=DATE([Year],[Month],[day])
Finally, you can create a slicer as Tulio_DL posted. In addition, there is a similar thread you can reference to.
Best Regards,
Angelia
14 Replies
- vanessafvgCommunity Champion
majidhtdefine specific time frame you can either filter out the data at the power query level (in imported mode)
or you can use the slicers to define date
or you can hard code some date specifics in your visual / page / report filters
- majidhtFrequent Visitor
Thanks for your reply. Imagine I want to see the sales between March 1st 2016 to Feb 15th 2017. How would you do it using slicers?
- Tulio_DLHelper I
Hello majidht!
You can do it by creating a CALENDAR table and establishing a relationship between your 'Sales'[dates] to 'Calendar'[dates].
Then on your report you create a filter with your 'Calendar'[dates].
Anda that should do the work!
Hope that helps.