locked
Regression testing DAX formula that creates a table works in DAX studio not in powerbi; syntax for Evaluate incorrect RRS feed

  • Question

  • This works is based on this article  https://powerpivotpro.com/2018/09/automated-testing-using-dax-for-power-bi/

    I'm a relative newbie to DAX.  The dax expression below return the expected data in DAS studio

    I'm trying to add the following dax expression to powerbi and am getting error syntax for Evaluate is incorrect

    EVALUATE 
    ADDCOLUMNS (
        UNION (
            ROW (
                "Test Name", "Enrollment Patient Control vs Patient",
                "Expected Value", CALCULATE (
                    DISTINCTCOUNT ( 'Patient Control'[patient_id] ),
                    'Patient Control'[phase] = "enrolled",
                    'Patient Control'[ignore_row_flg] = 0
                ),
                "Actual Value", CALCULATE (
                    DISTINCTCOUNT ( 'Patient'[Patient Id] ),
                    'Patient'[phase] = "enrolled"
                )
            ),
            ROW (
                "Test Name", "Enrollment Patient Control vs PatientActivity",
                "Expected Value", CALCULATE (
                    DISTINCTCOUNT ( 'Patient Control'[patient_id] ),
                    'Patient Control'[phase] = "enrolled",
                    'Patient Control'[ignore_row_flg] = 0
                ),
                "Actual Value", CALCULATE (
                    DISTINCTCOUNT ( 'Patient'[Patient Id] ),
                    'Patient'[phase] = "enrolled",
                    value('factPatientActivity'[Currententryindicator]) = 0
                )
            )

     ),
        "Test Failed", IF ( [Expected Value] <> [Actual Value], "Yes", BLANK () )
    )

    

    Thursday, April 16, 2020 12:50 PM

Answers

All replies