Forum Discussion
Result from SWITHC not as expected
- 6 years ago
Thanks for the data. Your data doesn't allow for the results you want. For example, in your data, row 2 and 4 are identical:
- Date Agreed is null
- Contact Date is not null
- Status Name is "Accepted
There is no other critera for the SWITCH to return a 2 for row 2 and a 4 for row 4.
As for the others that were off, the below will fix it.
Result = SWITCH ( TRUE (), NOT ( ISBLANK ( [Date Agreed] ) ) && NOT ( ISBLANK ( [Contact Date] ) ), 1, ISBLANK ( [Date Agreed] ) && NOT ( ISBLANK ( [Contact Date] ) ) && [Status Name] = "Accepted", 2, NOT ( ISBLANK ( [Date Agreed] ) ) && [Status Name] = "Accepted", 3, ISBLANK ( [Date Agreed] ) && [Status Name] = "Accepted", 4, NOT ( ISBLANK ( [Date Agreed] ) ) && [Status Name] = "Rejected", 5, ISBLANK ( [Date Agreed] ) && [Status Name] = "Rejected", 6 )You can see my results below, and the red boxes highlighted what I changed in your Calculated Column formula.
Hi,
Thank you for your response.
Here are details from data..sorry can't share real data due to privacy but have created exactly same table;
This is Source Table :
Here is current output;
Based on SWITCH formula i should get below output;
Expected Output:
Hope this will help you.
Thanks
Thanks for the data. Your data doesn't allow for the results you want. For example, in your data, row 2 and 4 are identical:
- Date Agreed is null
- Contact Date is not null
- Status Name is "Accepted
There is no other critera for the SWITCH to return a 2 for row 2 and a 4 for row 4.
As for the others that were off, the below will fix it.
Result =
SWITCH (
TRUE (),
NOT ( ISBLANK ( [Date Agreed] ) ) && NOT ( ISBLANK ( [Contact Date] ) ), 1,
ISBLANK ( [Date Agreed] ) && NOT ( ISBLANK ( [Contact Date] ) ) && [Status Name] = "Accepted", 2,
NOT ( ISBLANK ( [Date Agreed] ) )
&& [Status Name] = "Accepted", 3,
ISBLANK ( [Date Agreed] )
&& [Status Name] = "Accepted", 4,
NOT ( ISBLANK ( [Date Agreed] ) ) && [Status Name] = "Rejected", 5,
ISBLANK ( [Date Agreed] ) && [Status Name] = "Rejected", 6
)
You can see my results below, and the red boxes highlighted what I changed in your Calculated Column formula.