Forum Discussion
Conditional formatting on a field based on field length
- Anonymous2 years ago
Hi Dayna ,
My idea is to create a what-if parameter, get its value and save it as a variable to be passed to the code in the conditional format.
Use parameters to visualize variables - Power BI | Microsoft Learn
Then create 2 measures for conditional format:Measure 1 = VAR _len = MAX('Lengths'[Lengths]) VAR _result = IF(LEN(MAX('Table'[Barcode 1]))=_len,"Green","Red") RETURN _resultMeasure 2 = VAR _len = MAX('Lengths'[Lengths]) VAR _result = IF(LEN(MAX('Table'[Barcode 2]))=_len,"Green","Red") RETURN _resultWhen the length parameter is changed, the condition format also changes.
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi Dayna ,
My idea is to create a what-if parameter, get its value and save it as a variable to be passed to the code in the conditional format.
Use parameters to visualize variables - Power BI | Microsoft Learn
Then create 2 measures for conditional format:
Measure 1 =
VAR _len = MAX('Lengths'[Lengths])
VAR _result = IF(LEN(MAX('Table'[Barcode 1]))=_len,"Green","Red")
RETURN
_resultMeasure 2 =
VAR _len = MAX('Lengths'[Lengths])
VAR _result = IF(LEN(MAX('Table'[Barcode 2]))=_len,"Green","Red")
RETURN
_result
When the length parameter is changed, the condition format also changes.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum