Initial Value based on current view

Hi.

I am trying to set the initial value of a column based the view the user is in. The column, [Moisture Content], is included in 3 slices. If the user is in either of the first 2 slices/views I just want to return the existing [Moisture Content] value but if they are in the 3rd slice/view AND the value is above 28 I want to set the value back to 28. I have something like this as my expression but I am getting and error.

Expression:
IFS(
CONTEXT(“Fabrication (Create) Stage”),[Moisture Content],
CONTEXT(“Fabrication (Update) Stage”),[Moisture Content],
AND(CONTEXT(“Pre-Treatment Stage”),[Moisture Content]>28),28
)

Error
Condition AND(CONTEXT(“Pre-Treatment Stage”), ([Moisture Content] > 28)) has an invalid structure: subexpressions must be Yes/No conditions

Hope this makes sense. Any advice would be great, thank you.

Try this:

IFS(
CONTEXT(“View”) = “Fabrication (Create) Stage”,[Moisture Content],
CONTEXT(“View”) = “Fabrication (Update) Stage”,[Moisture Content],
AND(CONTEXT(“View”) = “Pre-Treatment Stage” , [Moisture Content]>28 ) , 28
)

1 Like

Thanks so much @Fernando_Lopez

1 Like

Your welcome