Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

If Statement applied at a certain aggregated level

Hi, I need help with DAX.     I have a table that has a varius level of aggregate.  (Region, Office, Sales Person).   How do I write the following measures? 1) Aggregate Numerator and Denomin...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous ,

    You can create two measures as below to get it, please find the details in the attachment.

    Percent = DIVIDE(SUM('Table'[Numerator]),SUM('Table'[Denominator])) 
    Office level = 
    VAR _sumofper =
        SUMX ( ALLEXCEPT ( 'Table', 'Table'[Office] ), [Percent] )
    RETURN
        SWITCH (
            TRUE (),
            _sumofper > 1, "Perfect",
            _sumofper > 0.8
                && _sumofper <= 1, "Good",
            _sumofper > 0.6
                && _sumofper <= 0.8, "Average",
            _sumofper <= 0.6, "Bad"
        )

    Best Regards