Forum Discussion

kivanct's avatar
kivanct
Icon for Helper I rankHelper I
3 years ago
Solved

Applying Color to the Closest Value

Hi everyone, I would like to share my issue. I would be grateful if you could help me to solve it.  These are the production lines in the first column like 1924-1925 etc.  My aim is "7". ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi kivanct ,

     

    Please check this modified measure.

    Closet Value =
    VAR _1 =
        SUM ( 'Table'[14 Saat] )
    VAR _2 =
        SUM ( 'Table'[17.25 Saat] )
    VAR _3 =
        SUM ( 'Table'[20.5 Saat] )
    VAR _A1 =
        ABS ( _1 - 7 )
    VAR _A2 =
        ABS ( _2 - 7 )
    VAR _A3 =
        ABS ( _3 - 7 )
    RETURN
        IF (
            _1 > 7
                && _2 > 7
                && _3 < 7,
            _3,
            IF (
                _1 > 7
                    && _2 < 7
                    && _3 > 7,
                _2,
                IF (
                    _1 < 7
                        && _2 > 7
                        && _3 > 7,
                    _1,
                    IF (
                        _1 < 7
                            && _2 < 7
                            && _3 > 7,
                        IF ( _A1 >= _A2, _2, _1 ),
                        IF (
                            _1 < 7
                                && _2 > 7
                                && _3 < 7,
                            IF ( _A1 >= _A3, _3, _1 ),
                            IF (
                                _1 > 7
                                    && _2 < 7
                                    && _3 < 7,
                                IF ( _A2 >= _A3, _3, _2 ),
                                IF ( _A1 >= _A2, IF ( _A2 >= _A3, _3, _2 ), _1 )
                            )
                        )
                    )
                )
            )
        )
    

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.