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 all,
How can I add to the below FILTER formula to only return values in the last 14 days?
There is a Action Date in the Candidate Actions table (shown below).
I would like CV : Job to only return values in the last 14 days.
Thanks,
Henry
Solved! Go to Solution.
Create a new column in the table
Date Action = format(Table[Action Date],"mm/dd/YYYY")
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
Then use a formula like
Lat 14 days = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[date],max(Sales[Sales Date]),-14,DAY))
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Hi @HenryJS
If the above post helps, could you please consider Accept it as the solution to help the other members find it more quickly. thanks!
If the issue still exists, please kindly share more details, we'd like to provide further helps.
Create a new column in the table
Date Action = format(Table[Action Date],"mm/dd/YYYY")
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
Then use a formula like
Lat 14 days = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[date],max(Sales[Sales Date]),-14,DAY))
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Hi @amitchandak ,
Thanks for getting back to me.
Please see below
I think you should add date calendar (https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions)
Try
CV:Job = calculate(sum(CandidateActions[Activities]),FILTER(CandidateActions,CandidateActions[ActionName]="CV Sent" && CandidateActions[CandidateRef]=Candidates[CandidateRef])
,DATESINPERIOD('Date'[date],max(CandidateActions[Date Action]),-14,DAY) )
In case you do not have the calendar then use action date[action date] in place of date[date]
Perhaps create a "Days Difference"column that calculates the difference in days between today and your date field. Then you can create an "Is within 14 Days Flag" column, that sets the value to either 1 or 0 if the "Days Difference" column is -14 or greater(i.e. -14, -13, -12,...) and less than 0. Next, in your summation Measure, you can calculate the sum based on the "Is within 14 Days Flag" equal to 1.
Not sure if the timestamp within your Date field will give you problems with my suggestion but you can always create a new Date field that's formatted without the timestamp and then use this new Date field to perform the above.
@HenryJS last 14 days from today?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@HenryJS add date table in your model, there are many posts on how to add one. For time intelligence, date table make things easier to work.
- Mark date table as date.
- Set relationship on this date table with your action table and then add following measure
Last 14 Days =
CALCULATE (
SUM ( ActionTable[Activities] ),
DATESINPERIOD ( DateTable[Date], TODAY(), -14, DAY )
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k I can't mark as date table because date column can only have one timestamp per day and the date column can't have gaps in dates
@HenryJS this you are going to do on date table not your activity table
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
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 |
---|---|
67 | |
58 | |
50 | |
36 | |
34 |
User | Count |
---|---|
84 | |
73 | |
58 | |
45 | |
44 |