Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Discount count multiple tables

I have these two tables:

Assigment:

empid projid      

1011054
1011050
1031052
1071053
1021053
1041051

 

Projects:

projid  name   customer

1050SunPhilips
1051MoonASML
1052StarsASML
1053GalaxyDLL
1054MarsPhilips

 

As you can see, projid 1050 and 1054 and projid 1051 and 1052 have the same customer. I want to calculate the amount of projects an employee had for different customers, but if an employee has projid 1050 and 1054, it will count as 1 project. Does someone knows how to do this?

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi @mrstillchicken,

     

    Here’s the sample data I used according to your description:

    Please check following steps as below and see if the result achieve your expectation:

    1. Manage relationship between two tables:

    2. Create measure:

        distinctcount = CALCULATE(DISTINCTCOUNT(Projects[customer]),FILTER(Assigment,Assigment[empid] = MAX(Assigment[empid])))

    3. Result would be shown as below:

    BTW, Pbix as attached. Hopefully works for you.

     

    Best Regards,

    Jay

     

    Community Support Team _ Jay Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi @mrstillchicken,

     

    Here’s the sample data I used according to your description:

    Please check following steps as below and see if the result achieve your expectation:

    1. Manage relationship between two tables:

    2. Create measure:

        distinctcount = CALCULATE(DISTINCTCOUNT(Projects[customer]),FILTER(Assigment,Assigment[empid] = MAX(Assigment[empid])))

    3. Result would be shown as below:

    BTW, Pbix as attached. Hopefully works for you.

     

    Best Regards,

    Jay

     

    Community Support Team _ Jay Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.