Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi Everyone,
New Power BI user here, dropped in at the deep end! I have a column within my table called 'last_service_date'. The data within it is formatted as Date/time. I'm have created a new column called 'Last week' with the goal of finding out which items have been serviced within the last seven days from todays date, using the following code:
last week =
IF(
DATEDIFF(MySheet[last_service_date], TODAY(), DAY) < 7,
"Within last 7 days",
"Not within last 7 days"
)
However, I am only recieving "Not within last 7 days" as my result, regardless of the the completion date of the service. Could anyone shine a light on where I have gone wrong? Thank you in advance! 🙂
Solved! Go to Solution.
Hi @DBC01
There is nothing wrong with the DAX, please see the SNAP below. Working as expected.
Please check again the datatype of the date column and check if there is any data within the 7-day range.
Or increase the range 30days and check
Hi @DBC01
There is nothing wrong with the DAX, please see the SNAP below. Working as expected.
Please check again the datatype of the date column and check if there is any data within the 7-day range.
Or increase the range 30days and check
Thank you @PijushRoy .
As I am clinically stupid I forgot that we are now in 2024 and not 2023! I've changed some dates around and the DAX works as expected.