Forum Discussion

EZiamslow's avatar
EZiamslow
Helper III
4 years ago
Solved

If value is between two numbers from another table

Look up table: Product StartStep EndStep Apple 1 7 Apple 19 36 Apple 41 46 Apple 54 61 Orange 1 11 Orange 35 42 Orange 55 62   Fact table: Product S...
  • VahidDM's avatar
    4 years ago

    HI EZiamslow 

     

    Trty this code to add a new column by using DAX:

    YN Column = 
    VAR _Step = 'Fact'[Step]
    RETURN
        IF (
            CALCULATE (
                COUNTROWS ( 'Look up' ),
                FILTER (
                    'Look up',
                    'Look up'[Product] = EARLIER ( 'Fact'[Product] )
                        && 'Look up'[EndStep] >= _Step
                        && 'Look up'[StartStep] <= _Step
                )
            ) > 0,
            "Yes",
            "No"
        )
    

     

    Output:



    Sample file attached for your reference

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

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube