One of the necessities to master while performing even simple data analysis is to carry out the calculation on specific group, i.e. #Groupby

In Power BI, such is done by functions ALLEXCEPT and CALCULATE. Here is an example. Let´s say we want to calculate the number of people within different departments of the company in different time spans. The simple formula for that is as follows:

Count_people = CALCULATE(DISTINCTCOUNT(Report[employee_number]);ALLEXCEPT(Report;Report[Days];Report[Departments]))

Combination of CALCULATE and DISTINCTCOUNT calculates the number, ALLEXCEPT specifies by which groups. Straightforward, right?

One of the necessities to master while performing even simple data analysis is to carry out the calculation on specific group, i.e. #Groupby

In Power BI, such is done by functions ALLEXCEPT and CALCULATE. Here is an example. Let´s say we want to calculate the number of people within different departments of the company in different time spans. The simple formula for that is as follows:

Count_people = CALCULATE(DISTINCTCOUNT(Report[employee_number]);ALLEXCEPT(Report;Report[Days];Report[Departments]))

Combination of CALCULATE and DISTINCTCOUNT calculates the number, ALLEXCEPT specifies by which groups. Straightforward, right?