Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
Proud to be a Super User! | |
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
Proud to be a Super User! | |
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.
No Problem @DBC01
You are welcome
Proud to be a Super User! | |
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
77 | |
73 | |
58 | |
35 | |
31 |
User | Count |
---|---|
99 | |
57 | |
56 | |
46 | |
40 |