Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
In report builder I want to add conditional formatting to a column (RFH_DUE_DATE) in a table, the table's main dataset is from the Tracker dataset. I created RFH_DUE_DATE from the Provider dataset.
The column is created from a Lookup expression: RFH_DUE_DATE= IIf(IsNothing(Fields!RPR.Value), DateAdd(DateInterval.Day, 180, Lookup(CInt(Fields!P_ID.Value), CInt(Fields!ID.Value), CStr(Fields!NPR.Value), "Prov")), DateAdd(DateInterval.Day, 180, Fields!RPR.Value))
For the conditional formatting I want to change the fill color-
-Finished: Green
-Due Within 30 Days: Red
-Due Within 90 Days: Yellow
-Finished: If the RFH_FILED is not null or PRRB_INDIVIDUAL_CASE__ is not null or NOTES like “missed”
-Due Within 30 Days: If not Finished and the RFH_DUE_DATE – Today <= 30
-Due Within 90 Days: If not Finished and the RFH_DUE_DATE – Today between 31 and 90
Here is my expression for the background fill:
=switch(isnothing(Fields!RFH_FILED.Value) = FALSE, "Green", isnothing(Fields!PRRB_INDIVIDUAL_CASE__.Value) = FALSE, "Green", instr(Fields!NOTES.Value, "missed") > 0, "Green", (isnothing(Fields!RFH_FILED.Value) = TRUE OrElse isnothing(Fields!PRRB_INDIVIDUAL_CASE__.Value) = TRUE OrElse instr(Fields!NOTES.Value, "missed") = 0) AndAlso datediff(DateInterval.Day,IIf(IsNothing(Fields!RNPR.Value), DateAdd(DateInterval.Day,180,Lookup(CInt(Fields!Provider_ID.Value),CInt(Fields!ID.Value),CStr(Fields!NPR.Value),"Provider")),DateAdd(DateInterval.Day,180,Fields!RNPR.Value)), Today()) <= 30, "Red", (isnothing(Fields!RFH_FILED.Value) = TRUE OrElse isnothing(Fields!PRRB_INDIVIDUAL_CASE__.Value) = TRUE OrElse instr(Fields!NOTES.Value, "missed") = 0) AndAlso datediff(DateInterval.Day, IIf(IsNothing(Fields!RNPR.Value),DateAdd(DateInterval.Day,180,Lookup(CInt(Fields!Provider_ID.Value),CInt(Fields!ID.Value),CStr(Fields!NPR.Value),"Provider")),DateAdd(DateInterval.Day,180,Fields!RNPR.Value)), Today()) > 30, "Yellow", 1=1, "Transparent")
When I run the report the entire column incorrectly turns all green, I cannot get any of the other colors in my expression to work.
How can I correct this expression?
You have 3 different branches in your Switch returning the value "Green" - I would temporarily change 2 of these to something else like "Pink" and "Blue" then you should be able to see which branches of the switch are being applied and it should be easier then to look at your expressions and your data to see what is wrong with the logic.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |