locked
Filter question RRS feed

  • Question

  • Hello

    I’ve got a measure written 2 ways, almost exactly the same. The difference is the order in the Filter. <o:p></o:p>

    <o:p> </o:p>

    Why do I get two different results because of the filter order in the filter. There can be blank values in the attributes

    <o:p></o:p>

    This measure returns the correct results …

    <o:p> </o:p>

    //GOOD TO GO<o:p></o:p>

    EVALUATE<o:p></o:p>

    ROW (<o:p></o:p>

        "a", CALCULATE (<o:p></o:p>

            COUNTA ( StudentExam[StudentID] ),<o:p></o:p>

            FILTER (<o:p></o:p>

                StudentExam,<o:p></o:p>

                StudentExam[LeftModule] <> "Yes" <o:p></o:p>

                    && StudentExam[Grant] <> "No"<o:p></o:p>

                    && NOT ISBLANK ( StudentExam[Grant] )<o:p></o:p>

            )<o:p></o:p>

        )<o:p></o:p>

    )<o:p></o:p>

     <o:p></o:p>

     This one doesn’t…<o:p></o:p>

     <o:p></o:p>

    //WRONG ????<o:p></o:p>

    EVALUATE<o:p></o:p>

    ROW (<o:p></o:p>

        "b", CALCULATE (<o:p></o:p>

            COUNTA ( StudentExam[StudentID] ),<o:p></o:p>

            FILTER (<o:p></o:p>

                StudentExam,<o:p></o:p>

                StudentExam[Grant] <> "No"<o:p></o:p>

                    && NOT ISBLANK ( StudentExam[Grant]<o:p></o:p>

                        && StudentExam[LeftModule] <> "Yes" )<o:p></o:p>

            )<o:p></o:p>

        )<o:p></o:p>

    )<o:p></o:p>

    <o:p> </o:p>

    Thanks in advance<o:p></o:p>

    Roy.<o:p></o:p>

    Monday, December 2, 2019 8:09 PM

All replies

  • It's really hard to read with all those extra tags in there, but it's not just the order that is different you have the brackets in separate places.

    Your first expression is checking:

    NOT ISBLANK ( StudentExam[Grant] )

    And the second expression is checking:

    NOT ISBLANK ( StudentExam[Grant] && StudentExam[LeftModule] <> "Yes" )

    Which will probably explain the different values returned


    http://darren.gosbell.com - please mark correct answers

    Tuesday, December 3, 2019 8:40 AM