Forum Discussion
Date Function Error
- 1 year ago
Hi Khomotjo - Yes, you can create a new column in Power BI using DAX that extracts only the date part from a date-time column without using DATE() or formatting it directly from the toolbar. You can use the TRUNC function in DAX.
Take a new column
DateOnly = TRUNC('TableName'[DateTimeColumn])
rajendraongole1 I just noticed that this measure returns 31 December 2025 which is incorrect. It seems that the measure caculates the maximum date in the current year. The max date is 22 January 2025.
- rajendraongole11 year agoSuper User
Hi Khomotjo - can you please change the Max to MAXX as like below measure.
TestDateMeasure =
DATE(
MAXX(StockMovements, StockMovements[P9_WhsWorkFlowFinalisedDateYear]),
MAXX(StockMovements, StockMovements[Month_Number]),
MAXX(StockMovements, StockMovements[P9_WhsWorkFlowFinalisedDateDay])
)still if max is giving trouble , try with SELECTEDVALUE function.
I hope this works. please check
- Khomotjo1 year agoHelper II
Thanks rajendraongole1 Anonymous I am trying to get one date for each of the multiple date entries in the data. For example on the 22 January I might have 3 orders finalised at 11:00, 12:00 and 13:00. The data will will show all 3 with their respective date time records. I want to calculate the total orders finalised on the 22 January, the issue is the model considers these 3 as separate because of the time. I tried to format the date from the tool bar( change to short date) but when I pull the table it still considers the time. It looks like this :
I want to see only 1 entry for each of the dates in the data,
- rajendraongole11 year agoSuper User
Hi Khomotjo - To group the data by date and calculate the total orders finalized for each day (ignoring the time component), you can create a measure in Power BI that extracts only the date from the datetime field as like below:
Total Orders by Date =
CALCULATE(
COUNT('YourTable'[OrderID]),
ALLEXCEPT('YourTable', 'YourTable'[DateOnly])
)you need to replace 'YourTable'[DateOnly] with a column created using the date part of your datetime column.