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
lpriceFTW
Helper II
Helper II

Distinct list of DATES only from column of DATE+TIMES

##########################################################################################

# I am removing all html formatting because of a Fabric error preventing me from posting. Please bear with me on this #

##########################################################################################

 

 

How do I create a new table of unique DATES (1/1/2023) from a column of DATETIMES (1/1/2023 10:30am)?

Lets say I have a column of DATETIMES like so:

 

___________________
| 10/1/23 10:30am |
| 10/1/23 11:30am |
| 10/1/23 9:30am   |
| 10/2/23 1:30pm  |
| 10/3/23 8:30am  |
| 10/3/23 7:30pm  |
| 10/3/23 5:30am  |

 

I want a returned table of unique DATE values like so:

 

___________
| 10/1/23 |
| 10/2/23 |
| 10/3/23 |

 

DAX would be something like:

 
```` dates = values(bot_activity_date[started].[dates]) //DOES NOT WORK!!! ```
1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@lpriceFTW  try this

 

EVALUATE
SUMMARIZE(ADDCOLUMNS(DATETIMES,"@yr", CONVERT(DATEVALUE(DATETIMES[colOne]),DATETIME)),[@yr])

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

6 REPLIES 6
smpa01
Super User
Super User

@lpriceFTW  try this

 

EVALUATE
SUMMARIZE(ADDCOLUMNS(DATETIMES,"@yr", CONVERT(DATEVALUE(DATETIMES[colOne]),DATETIME)),[@yr])

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

This worked. Thank you!

3CloudThomas
Super User
Super User

Create a Calulated Column in table
FieldDate = FORMAT(DateTime, "mm/dd/yyyy")
Then, in Data view of pbix file, create a new Table - there is a button under table tools

Add a column UniqueDates = DISTINCT(FieldDate)

 

shorter without a need for a calculated column in the source table:

 

Table =
   DISTINCT(
       SELECTCOLUMNS(
          SUMMARIZE(SourceTable, SourceTable[DateCol], "DateFormatted", FORMAT(SourceTable[DateCol], "DD/MM/YYYY")), [DateFormatted])
)
lukiz84
Memorable Member
Memorable Member

do you want to use powerquery or dax (if dax, then calculated table or only for a measure?)? 

DAX - its for a calculated table.

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.