Forum Discussion

TARANEESH's avatar
TARANEESH
Frequent Visitor
7 years ago

Row by Row comparison with dates

Hi all,

 I am beginner trying to understand Power BI and DAX.

 I want help with the below issue.

 For example,I have the following table in which Account_Number is repeated(i.e.Not unique) with date enroll and Termination.

Account_Number

Date_Enroll

Date_Terminated

1

01-08-2019

04-08-2019

2

02-08-2019

06-08-2019

4

03-08-2019

05-08-2019

3

04-08-2019

07-08-2019

1

05-08-2019

10-08-2019

4

06-08-2019

31-12-9999

2

07-08-2019

31-12-9999

3

08-08-2019

05-08-2019

 Scenario:

I want the new column (column-name:Account_Status) containing only two values (i.e. Open & Terminated).

 Open----> for the accounts which has last date_terminated as 31-12-9999.

 Terminated ----->for the accounts which has other last date_terminated.

 Reuired Table:-

Account_Number

Date_Enroll

Date_Terminated

Account status

1

01-08-2019

04-08-2019

Terminated

2

02-08-2019

06-08-2019

Open

4

03-08-2019

05-08-2019

Open

3

04-08-2019

07-08-2019

Terminated

1

05-08-2019

10-08-2019

Terminated

4

06-08-2019

31-12-9999

Open

2

07-08-2019

31-12-9999

Open

3

08-08-2019

05-08-2019

Terminated

Please help me with this. Thanks in advance.

 

4 Replies

    • TARANEESH's avatar
      TARANEESH
      Frequent Visitor

      Hi,

      Iamnvt 

       

      The solution is not working.

       

      See if account_number is once terminated with date_terminated <>(not equal to) 31/12/9999,I want the account_status column (corresponding to a particular account_number in every row) should return "Terminated".

      • Iamnvt's avatar
        Iamnvt
        Continued Contributor

        TARANEESH  in the PBI I attached. It gives exactly the expected result.