Forum Discussion
kyrpav
6 years agoHelper V
expression language as in java a powerbi
Hello If I have some columns of the database I store thresolds and colors like Thresold Color >0.9 #00ff00 >-0.8 && <-0.9 #ffbf00 <0.8 #fb3318 Is it possible that you c...
v-eachen-msft
6 years agoCommunity Support
Hi kyrpav ,
You could use slicer to define the dynamic parameter.
Firstly, you need to create a new table to save your thresolds and use it as a slicer. Then create a measure like the following DAX:
Measure =
VAR a =
MINX ( ALLSELECTED ( 'thresolds' ), 'thresolds'[Value] )
VAR b =
MAXX ( ALLSELECTED ( 'thresolds' ), 'thresolds'[Value] )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Table'[Value] ) > b, "#00ff00",
SELECTEDVALUE ( 'Table'[Value] ) <= b
&& SELECTEDVALUE ( 'Table'[Value] ) >= a, "#ffbf00",
SELECTEDVALUE ( 'Table'[Value] ) < a, "#fb3318"
)
Put this measure into conditional formatting. Here is my result for your reference.
- kyrpav6 years agoHelper V
You are hardcoding the condition. I may not know which thresold has to be checked with is bigger, bigger or equal etc...
I am thinking of changind db to have different columns based on condition bigger ... and then use them one by one.