Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pramita
Helper II
Helper II

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. 
4 ACCEPTED SOLUTIONS
musicbydannyd
Advocate IV
Advocate IV

@pramita, instead of "OR", try "||" instead. Good luck.

View solution in original post

ryan_mayu
Super User
Super User

@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.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

amitchandak
Super User
Super User

@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]))

View solution in original post

v-juanli-msft
Community Support
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.

View solution in original post

4 REPLIES 4
v-juanli-msft
Community Support
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.

amitchandak
Super User
Super User

@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]))
ryan_mayu
Super User
Super User

@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.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




musicbydannyd
Advocate IV
Advocate IV

@pramita, instead of "OR", try "||" instead. Good luck.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.