Forum Discussion
saanah2019
7 years agoHelper II
new column value based on conditions
Hi I have a very basic question that I am not able to find the answer to here. So I will have one table that i need to look at and it will have a specific id, then the insurance name and a date of t...
- 7 years ago
Hi saanah2019,
Try this for your calculated column, where Table1 is the table you show:
NewColumn_Status = VAR _NumberOfInsurers = CALCULATE ( DISTINCTCOUNT ( Table1[insurance ] ); ALLEXCEPT ( Table1; Table1[visit id] ) ) RETURN IF ( _NumberOfInsurers = 1; "paid"; IF ( _NumberOfInsurers > 1; IF ( CALCULATE ( MIN ( Table1[date] ); ALLEXCEPT ( Table1; Table1[visit id] ) ) = Table1[date]; "not paid"; "paid" ) ) )
AlB
7 years agoCommunity Champion
Hi saanah2019,
Try this for your calculated column, where Table1 is the table you show:
NewColumn_Status =
VAR _NumberOfInsurers =
CALCULATE (
DISTINCTCOUNT ( Table1[insurance ] );
ALLEXCEPT ( Table1; Table1[visit id] )
)
RETURN
IF (
_NumberOfInsurers = 1;
"paid";
IF (
_NumberOfInsurers > 1;
IF (
CALCULATE ( MIN ( Table1[date] ); ALLEXCEPT ( Table1; Table1[visit id] ) ) = Table1[date];
"not paid";
"paid"
)
)
)