Mourad Boulkroune
Mourad Boulkroune

Reputation: 3

Calaculated column

Goog morning;

i have à column with contract end date of 10000 persons. Some persons have an indefinite contract date. i want to create a calculated column on DAX to return "Active" if the contract end date is less than two years( from today's date) or if the value is null (no end contract date)

And it must return "inactive" if the contract end date is more than 2 years from today's date.

Upvotes: 0

Views: 39

Answers (1)

smpa01
smpa01

Reputation: 4282

Active/Inactive = 
VAR _1 =
    DIVIDE(CONVERT ( TODAY () - CALCULATE(MAX ( tbl[Dates] )), INTEGER )-1, 365)
VAR _2 =
    SWITCH ( TRUE (), _1 > 2, "Inactive", "Active" )
RETURN
    _2

Upvotes: 1

Related Questions