Forum Discussion

pramita's avatar
pramita
Helper II
6 years ago
Solved

Multiple OR

This is my code, I want to find out the number of fewer than 4 ratings an employee has given for specific questions. I would like to know where I'm going wrong.
 
DI JR = DIVIDE(CALCULATE(
COUNTROWS(INPUT),
'INPUT'[Level] = "JR",
OR(
OR(
OR(
OUTPUT[Q1] < 4,
OUTPUT[Q5] < 4
),
OR(
OUTPUT[Q7] < 4,
OUTPUT[Q8] < 4
)
),
OUTPUT[Q11] < 4),
),
DISTINCTCOUNT(OUTPUT[Email Address]))
 
It gives an error saying "Argument '4' in CALCULATE function is required."
Any feedback is welcome. Thanks. 
  • pramita 

    Just like what musicbydannyd suggested, OR can only add two conditions,e.g OR(OR(condition1,condition2),condition3.

    However || can add more than 2 conditions, e.g. condition1 || condition2 || condition3 ||....||condition N.

     

  • pramita , try like

    DI JR = DIVIDE(CALCULATE(
    COUNTROWS('INPUT'),filter('INPUT',
    'INPUT'[Level] = "JR",
    OR(
    OR(
    OR(
    OUTPUT[Q1] < 4,
    OUTPUT[Q5] < 4
    ),
    OR(
    OUTPUT[Q7] < 4,
    OUTPUT[Q8] < 4
    )
    ),
    OUTPUT[Q11] < 4)
    )),
    DISTINCTCOUNT(OUTPUT[Email Address]))
  • Hi pramita 

    Try below:

    DI JR =
    DIVIDE (
        CALCULATE (
            COUNTROWS ( INPUT ),
            VALUES ( 'INPUT'[Level] ) = "JR",
            FILTER (
                OUTPUT,
                OR (
                    OR (
                        OR ( OUTPUT[Q1] < 4, OUTPUT[Q5] < 4 ),
                        OR ( OUTPUT[Q7] < 4, OUTPUT[Q8] < 4 )
                    ),
                    OUTPUT[Q11] < 4
                )
            )
        ),
        DISTINCTCOUNT ( OUTPUT[Email Address] )
    )
    

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • pramita , try like

    DI JR = DIVIDE(CALCULATE(
    COUNTROWS('INPUT'),filter('INPUT',
    'INPUT'[Level] = "JR",
    OR(
    OR(
    OR(
    OUTPUT[Q1] < 4,
    OUTPUT[Q5] < 4
    ),
    OR(
    OUTPUT[Q7] < 4,
    OUTPUT[Q8] < 4
    )
    ),
    OUTPUT[Q11] < 4)
    )),
    DISTINCTCOUNT(OUTPUT[Email Address]))
  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi pramita 

    Try below:

    DI JR =
    DIVIDE (
        CALCULATE (
            COUNTROWS ( INPUT ),
            VALUES ( 'INPUT'[Level] ) = "JR",
            FILTER (
                OUTPUT,
                OR (
                    OR (
                        OR ( OUTPUT[Q1] < 4, OUTPUT[Q5] < 4 ),
                        OR ( OUTPUT[Q7] < 4, OUTPUT[Q8] < 4 )
                    ),
                    OUTPUT[Q11] < 4
                )
            )
        ),
        DISTINCTCOUNT ( OUTPUT[Email Address] )
    )
    

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • pramita 

    Just like what musicbydannyd suggested, OR can only add two conditions,e.g OR(OR(condition1,condition2),condition3.

    However || can add more than 2 conditions, e.g. condition1 || condition2 || condition3 ||....||condition N.