简体   繁体   中英

SSRS Switch with And Expression need help , the second condition is not true

I need a help on the below Expression , I've

column A - Date, 

Column B-  Yes/No , 

Column C - Date.

Condition

If Column B = Yes and Column A has a Date then text box in *Grey

If Column A don't have Date, then check if Column C has date

then if Column C date > Today and Column B = No text box Green

If Column C date < Today and Column B = No text box Red

Also if there are no entries in any of the column then No color,

I tried to put ISNOTHING(For all 3 columns) with And Operator before switch statement

Add your conditions as an expression in the font/color property of the required cell.

=SWITCH(
    Fields![Column B].Value = "Yes" AND IsNothing(Fields![Column A].Value), "White",
    IsNothing(Fields![Column A].Value) and Fields![Column C].Value > Today() and Fields![Column B].Value = "", "Red",
    Fields![Column C].Value > Today() and Fields![Column B].Value = "Yes", "Gray",
    Fields![Column C].Value < Today(), "Green"
    )

First of all, it could not be the same what I'm providing you but you should try this,

=
SWITCH
(
    CStr(Fields!ColumnB.Value) = "Yes" AND NOT(IsNothing(CDate(Fields!ColumnA.Value))), "Grey",
    IIF(IsNothing(Fields!ColumnA.Value),IIF(NOT(IsNothing(Fields!ColumnC.Value)),IIF(CDate(Fields!ColumnC.Value) > Today() AND Fields!ColumnB.Value="","")),"Green")
    CDate(Fields!ColumnC.Value) > Today() AND Fields!ColumnB.Value="Yes","Red"
    IsNothing(Fields!ColumnA.Value) AND IsNothing(Fields!ColumnB.Value) AND IsNothing(Fields!ColumnC.Value), ""
)

Also, if above doesn't work then try using separated IIF Statements. It would be more easy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM