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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Inserting a column in to Date Table

Hi,

I need to put this logic in to a custom column or any other logical column as a seperate column in to my Date table,

 

Custom_Date=
VAR minDate =
CALCULATE ( MIN ( DateTable[Date] ) )
VAR maxDate =
CALCULATE ( MAX ( DateTable[Date] ) )
RETURN
IF (
MAX ( DateTable[Date] ) >= minDate
&& MAX ( DateTable[Date] ) <= maxDate,
minDate & " " & maxDate
)
 
Can anyone help me on this?
 
Thanks
1 ACCEPTED SOLUTION

@Anonymous 

It was supposed to be used in the Data Model using DAX. 
Add in the model date table and check if you get the results.

If you want to add it in Power Query, add below code as a new custom column

=Date.ToText(Date.StartOfYear([Date]),"dd-MMM-yy") &" --- "& Date.ToText( [Date],"dd-MMM-yy")




________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

7 REPLIES 7
Fowmy
Super User
Super User

@Anonymous 

I am not sure about the usage of this column in a visual but this custom column should give you what you expect:

Custom_Date = 

 VAR _START = MIN(DateTable[Date])
 VAR _CURRENT = [Date]

RETURN
 _START & "  " & _CURRENT 

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy 

I used your formula in custom column.But its shows an error.

 

Mishelle_0-1598857687033.png

 

Hi , @Anonymous 

@Fowmy 's solution could work.

If yes, please accept his reply as solution, so that other community members will easily find the solution when they get the same issue.For now, there is no content of description in the thread. If you still need help, please feel free to ask.

 

Best Regards,
Community Support Team _ Eason

@Anonymous 

It was supposed to be used in the Data Model using DAX. 
Add in the model date table and check if you get the results.

If you want to add it in Power Query, add below code as a new custom column

=Date.ToText(Date.StartOfYear([Date]),"dd-MMM-yy") &" --- "& Date.ToText( [Date],"dd-MMM-yy")




________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@Anonymous , what calculation you are looking for. Min and max you are taking in the column calculations are the min-max of the calendar. so you will end up getting

_min & " _ " _max

 

Appended min and max dates. What you are looking for?

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak 

Im want to get min and max date from the date calendar. I can get the dates using a measure.But i cant put a measure as a category in waterfall chart.I need to use this column as x axis in my water fall chart.So in the chart i want to show only first date of the year and todate.

Above i put my measure loguc and simply i need to use this logic in to a column.I tried calculated column but it didnt work.so i need to use this measure in query editor and use as a custom or conditional column.

 

Thanks

@Anonymous , if you want to show YTD, use datesytd with calendar and slicer

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

If you min date of the year you can use

startofyear([Date])  // make sure start of year date is there in calendar else it will take min available date

https://docs.microsoft.com/en-us/dax/startofyear-function-dax

 

 

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.