Forum Discussion
Dax If statement not working correctly.
- 2 years ago
v-yanimei-msft
Power BI accepts "rgba(255,255,255,0)", as you can see in the below image. I created two measures, [measure 2]and [measure 3] and used them in the background color for the shapes. And if you you observe both are working as per the conditionMeasure 3 = if (10<1, "rgba(255,255,255,1)","rgba(255,255,255,0)") Measure 2 = if (10>1, "rgba(255,255,255,1)","rgba(255,255,255,0)")
Hi dokat ,
Thank you for giving a specific description of the problem and the associated code. Through your description, I have found out what the problem is. The steps to resolve the issue are as follows.
1.Modify the code.
Legend Measure =
VAR SelectedSlicerValue = SELECTEDVALUE('Slicer'[Slicer Selection])
RETURN
IF (
SELECTEDVALUE('Slicer'[Slicer Selection]) = "Last Month",
// "rgba(255, 255, 255, 1)" , It cannot be recognized.
"red",
// "rgba(255, 255, 255, 0)", It cannot be recognized.
"transparent"
)
2. Apply conditional formatting. Learn about Apply conditional table formatting in Power BI - Power BI | Microsoft Learn.
3. The outcome is as follows.
Best Regards,
Caroline Mei
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- tharunkumarRTK2 years agoSuper User
v-yanimei-msft
Power BI accepts "rgba(255,255,255,0)", as you can see in the below image. I created two measures, [measure 2]and [measure 3] and used them in the background color for the shapes. And if you you observe both are working as per the conditionMeasure 3 = if (10<1, "rgba(255,255,255,1)","rgba(255,255,255,0)") Measure 2 = if (10>1, "rgba(255,255,255,1)","rgba(255,255,255,0)")