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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
HenryJS
Post Prodigy
Post Prodigy

Calculated Column: Return Values In Last 14 Days only

Hi all,

 

I have created a calculated column called 'CV:Job' (picture 3) in the Candidates table (picture 2) as per below.

 

I would like to filter this calculated column to only return values in the last 14 days (i.e. action dates in the last 14 days in Candidate Actions Table).

 

How can I ammend the DAX in picture 3 to solve this?

 

1. Candidate Actions Table

dax2.PNG

 

 

2. Candidates Table

dax3.PNG

 

3. CV:Job Calculated Column

dax4.PNG

 

 

Thanks,

 

Henry

6 REPLIES 6
v-eachen-msft
Community Support
Community Support

Hi @HenryJS ,

 

You can get data of the last 14 day with DATEDIFF() function and put it in the filter.

DATEDIFF('Candidate Actions'[Date Actions],CALCULATE(LASTDATE('Candidate Actions'[Date Actions]),ALLEXCEPT('Candidate Actions','Candidate Actions'[CandidateRef])),DAY)<=14)

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

@v-eachen-msft 

 

is this what you mean? If so it did not work

 

CV:Job = calculate(sum(CandidateActions[Activities]),FILTER(CandidateActions,CandidateActions[ActionName]="CV Sent" && CandidateActions[CandidateRef]=Candidates[CandidateRef] && DATEDIFF('Candidate Actions'[Date Action],CALCULATE(LASTDATE('Candidate Actions'[Date Action]),ALLEXCEPT('Candidate Actions','Candidate Actions'[CandidateRef])),DAY)<=14)))

 

Hi @HenryJS ,

 

I found an extra parenthesis in your DAX. You need to remove it and use the unified table name.

CV:Job =
CALCULATE (
    SUM ( CandidateActions[Activities] ),
    FILTER (
        CandidateActions,
        CandidateActions[ActionName] = "CV Sent"
            && CandidateActions[CandidateRef] = Candidates[CandidateRef]
            && DATEDIFF (
                'CandidateActions'[Date Action],
                CALCULATE (
                    LASTDATE ( 'CandidateActions'[Date Action] ),
                    ALLEXCEPT ( 'CandidateActions', 'CandidateActions'[CandidateRef] )
                ),
                DAY
            ) <= 14
    )
)

If it doesn't work, you need to describe whether it shows incorrect result or DAX can't run properly.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

@v-eachen-msft 

 

Thanks for your help. There are duplicate dates in the date column so could not run properly as per below.

 

dax20.PNG

 

Hi @HenryJS ,

 

Try to replace LASTDATE() with MAX() function.

If it still doesn't work, you could share your sample data if you don't have any confidential information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
HenryJS
Post Prodigy
Post Prodigy

Here is the relationship diagram

 

 

dax10.PNG

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.