Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Fall a value in a Range

Hello, Hope you are all doing great. I have two tables in powerbi Desktop: Table1 contains a column DueDays that has multiple integers in it from -500 to 1000. Table2 has 4 columns ID, MIN, MAX a...
  • Icey's avatar
    5 years ago

    Hi Anonymous ,

     

    Try this:

    Measure =
    VAR _CurrentDueDays =
        MAX ( Table1[DueDays] )
    VAR _MIN =
        CALCULATE ( MAX ( Table2[Min] ), Table2[Min] <= _CurrentDueDays )
    VAR _MAX =
        CALCULATE ( MIN ( Table2[Max] ), Table2[Max] >= _CurrentDueDays )
    VAR _Bracket =
        CALCULATE ( MAX ( Table2[Bracket] ), Table2[Min] = _MIN, Table2[Max] = _MAX )
    RETURN
        IF ( _CurrentDueDays >= _MIN && _CurrentDueDays <= _MAX, _Bracket )
    

     

     

    Best Regards,

    Icey

     

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