Forum Discussion
Slicer - Date and Time
- 9 years ago
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
Let me give you an example. I created facts and dimensions in SQL analysis server. In my current report I can create different charts and tables and slicers. For example, I want to see sales count by product category or sales by customer type. I can do this and then have a slicer for year, quarter or month to give me sales number by product category only in 2017 or only in January 2016. But imagine I want the same graph(sales number by product category) only in a specific time fram(like from 02/04/2015 to 03/05/2016). In this scenario, I cannot use a slicer or a filter to specify the start date and end date. Now I have to questions:
1-Is this achievable when I use connect live option(I connect to analysis server)?
2- If not, what is the solution if I use import option(to my understanding I need columns and DAX queries to make this possible)?
- Tulio_DL9 years agoHelper I
Ok!!
Don't worry majidht, that's quite simple to achieve and is the way I mentioned up on this topic:
1. You need to add a filter to your report
2. Drag your date column into it, make sure your data is modeled into DATE/TIME
You said you're connecting to a SQL database to reach your data, right? Something that happened to me when I started using PowerBI was that I used to connect to SQL by DirectQuery because it was so much faster.... But it turns out that I wasn't able to modelate data the way I wanted, so I changed the way to connect from Direct Query to Import Data so I could set up columns the way I pleased.
- majidht9 years agoFrequent Visitor
Yes! that's the problem. I am getting data from SSAS(I've created cubes and dimensions in visual studio), so there reason I am having problems is that all my dimensions are in text data type and I cannot convert them to numeric or date. I think my original question has been totally changed lol.