Forum Discussion

mrsgator's avatar
mrsgator
Frequent Visitor
2 years ago
Solved

Set Points within upper and lower limits

I'm trying to learn how to use DAX and need some help.  I have a set of data that consists of a vehicle name, data_date, set_point_1, independent_sensor_1 and a second table with the set points and t...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, mrsgator 

    I am glad to help you.   

     

    According to your description, you want to figure out the DAX to show if the set point is X, upper control limit is Y and the lower control limit is Z, then the independent_sensor_1 is within those limits? 

     

    If I understand you correctly, then you can refer to my solution.  

     

    You can refer to my DAX formula to create a Measure: 

     

    WithinLimits = 
    VAR SelectedSetPoint =
        SELECTEDVALUE ( 'Table1'[set_point_1] )
    VAR UpperLimit =
        LOOKUPVALUE ( 'Table2'[Upper Limit], 'Table2'[Set Point], SelectedSetPoint )
    VAR LowerLimit =
        LOOKUPVALUE ( 'Table2'[Lower Limit], 'Table2'[Set Point], SelectedSetPoint )
    VAR WithinOrNot =
        SELECTEDVALUE ( 'Table1'[independent_sensor_1] )
    RETURN
        IF (
            WithinOrNot >= LowerLimit
                && WithinOrNot <= UpperLimit,
            "Within Limits",
            "Out of Limits"
        )
    

     

    This is the result calculated using this DAX: 

     You can also set up a slicer with the different vehicle names: 

     

     

    I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
    Best Regards,
    Fen Ling,
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.