Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Group by category calculation

Please help me to find correct answer: Fact Table: FactStudent SchoolId StudId InSession   S1 11 5 SchoolLevelP= DISTINCT COUNT(StudId (NOTE: Those are in insession 7,8,9) ...
  • v-lili6-msft's avatar
    7 years ago

    hi, Anonymous

    You may try this formula

    Measure2 = 
    CALCULATE (
        DISTINCTCOUNT ( FactStudent[SchoolId] ),
        FILTER (
            ADDCOLUMNS (
                DimSchool,
                "SchoolLevelP", CALCULATE (
                    DIVIDE (
                        CALCULATE (
                            COUNT ( FactStudent[Schoolid] ),
                            FILTER (
                                FactStudent,
                                AND ( FactStudent[InSession] >= 7, FactStudent[InSession] <= 9 )
                            )
                        ),
                        COUNT ( FactStudent[StudId] )
                    ) * 100
                )
            ),
            COUNTROWS (
                FILTER (
                    Configuration,
                    [SchoolLevelP] >= Configuration[MinValue]
                        && [SchoolLevelP] < Configuration[MaxValue]
                )
            ) > 0
        )
    )

    Result:

     

    Best Regards,

    Lin

     

     

  • Anonymous's avatar
    Anonymous
    7 years ago

    Thanks! Its working as expacted result.