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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Only show distinct date values in slicer

Hi all,


I would like to do the following :

I have rows of data by date, with the date column using this format 2019-12-29 21:00:00.0000000

In Power Query, I duplicated the date column and change the new one to get the name of the day (eg. 'Wednesday').

The goal is for the end user to select a day, and get all the aggregated data for that day.


Problem is : when I create a slicer with this new measure, i still get many rows for each day name.

 

Is there a trick to only get one 'Sunday', one 'Saturday', etc. in the slicer ?


Best regards,

 

Martin.

2 ACCEPTED SOLUTIONS
Tahreem24
Super User
Super User

@Anonymous ,

First create column like below:

WeekDay = WEEKDAY('Date Table'[Date],1)
 
Then create second column like below:
DayName = SWITCH('Date Table'[Week],1,"Sunday",2,"Monday",3,"Tuesday",4,"Wednessdat",5,"Thursday",6,"Friday",7,"Saturday")
 
Then you can put DayName in your slicer and check the result. (Attached screenshot for your reference)
Capture.PNG
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

v-cazheng-msft
Community Support
Community Support

Hi, @Anonymous 

You don't need to duplicate the date column and Measure can't be put into Slicer. You can create a Calculated column and put this column in Slicer.

 

Weekday = FORMAT('date'[Date],"dddd")

 

The result looks like this:

v-cazheng-msft_0-1612420351780.jpeg

Best Regards,

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi,

 

Thank you all for your help.

 

I used what I thought was the simplest solution : a calculated column for the slicer (FORMAT('date'[Date],"dddd")), and another to order it (WEEKDAY('Date Table'[Date],1)).

 

Best regards,

 

Martin.

v-cazheng-msft
Community Support
Community Support

Hi, @Anonymous 

You don't need to duplicate the date column and Measure can't be put into Slicer. You can create a Calculated column and put this column in Slicer.

 

Weekday = FORMAT('date'[Date],"dddd")

 

The result looks like this:

v-cazheng-msft_0-1612420351780.jpeg

Best Regards,

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Tahreem24
Super User
Super User

@Anonymous ,

First create column like below:

WeekDay = WEEKDAY('Date Table'[Date],1)
 
Then create second column like below:
DayName = SWITCH('Date Table'[Week],1,"Sunday",2,"Monday",3,"Tuesday",4,"Wednessdat",5,"Thursday",6,"Friday",7,"Saturday")
 
Then you can put DayName in your slicer and check the result. (Attached screenshot for your reference)
Capture.PNG
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
VijayP
Super User
Super User

@Anonymous 

Create a Date Dimension table and Connect to the Fact Table to get unique Values in the Slicer.

Watch this video to know how to create DateTable

https://www.youtube.com/watch?v=C3ckN6LN6xo&list=PLWQB3PEUJKRmLf93pOxFQFIIe16ucwtW0&index=65




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors