Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
3 years ago
Solved

Measure looking for value in another table

Hello, I expose my case to see if you can help me again.

I have 2 related tables (DAILY Table and HISTORICAL Table) by the "Supervisor" column and also by the "Operator" column (although this relationship is inactive)

I am trying to show a report in which you see for the column "Supervisor" in the DAILY table, the data of a third column ("Incidents" that is in "HISTORY") and also the data of "operator" in that same row.

I mean:

DAILY Table:

DateSupervisorOperative
07/11/22A1
07/11/22B2
07/11/22C3
07/11/22D4
07/11/22E5
07/11/22F6

HISTORICAL TABLE:

DateSupervisorOperativeIncidents
01/11/22A17
03/10/21A115
06/06/20A23
05/04/19A21
01/10/22B11
06/09/22B3

6

05/08/22B33
04/07/21C22
13/06/21C51
10/06/20C32
05/08/22D65
25/07/22D512

Desired result:

SupervisorOperativeIncidents SupervisorIncidents Operator
A126 (sum of incidents in HISTORICAL table for supervisor A)23 (sum of incidents in HISTORICAL table for Operator 1)
B210 (sum of incidents in HISTORICAL table for supervisor B)6 (sum of incidents in HISTORICAL table for Operator 2)
C355
D450

The sum of the supervisor there is no problem but as soon as I think about how to add the operator I do not get any report similar to what I have described.

Thanks for reading!

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Syndicate_Admin ,

    I have created a simple sample, please refer to it to see if it helps you.

    Create meaures.

    Incidents = CALCULATE(SUM(history[Incidents]),FILTER(ALL(history),history[Supervisor]=SELECTEDVALUE(daily[Supervisor])))
    Supervisor1 = var _1= CALCULATE(SUM(history[Incidents]),FILTER(ALL(history),history[Supervisor]=SELECTEDVALUE(daily[Supervisor])&&history[Operative]=SELECTEDVALUE(daily[Operative])))
    return
    IF(_1=BLANK(),0,_1)

     

    If I have misunderstood your meaning, please provide mroe details with your desired output.

     

    Best Regards

    Community Support Team _ Polly

     

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

3 Replies

  • I didn't quite understand his solution.

    The "HISTORICO" table has more than 300,000 records. According to your solution, would you have to duplicate some columns of this table (supervisory date) to make new relationships? I think that would make the report much heavier than it already is now.

    I was trying to do something with the CALCULATE, FILTER and ALL functions but I did not get the expected result.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,

    I have created a simple sample, please refer to it to see if it helps you.

    Create meaures.

    Incidents = CALCULATE(SUM(history[Incidents]),FILTER(ALL(history),history[Supervisor]=SELECTEDVALUE(daily[Supervisor])))
    Supervisor1 = var _1= CALCULATE(SUM(history[Incidents]),FILTER(ALL(history),history[Supervisor]=SELECTEDVALUE(daily[Supervisor])&&history[Operative]=SELECTEDVALUE(daily[Operative])))
    return
    IF(_1=BLANK(),0,_1)

     

    If I have misunderstood your meaning, please provide mroe details with your desired output.

     

    Best Regards

    Community Support Team _ Polly

     

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