Forum Discussion

JuanDtM23's avatar
JuanDtM23
Helper II
5 years ago
Solved

Count values from one table in another table

Good afternoon

I have a reference table called "SERVICIOS_TRAZADORES" which looks like this:

JuanDtM23_0-1600543242906.png

Additionally I have a table called "Services Enabled" has the following form:

JuanDtM23_2-1600544507906.png

As noted, tables can be related using service code.

My intention is to calculate a measure that tells me the number of tracer services enabled.

That is, count in the "Services Enabled" table how many plotter services exist.

Any ideas?

Thanks in advance.

  • Are Tracer Services columns, such as outpatient, hospitable, etc.?

    If so, I suggest you test a UNPIVOT of the data in Power Query, so click Transform Data on the Home tab to open Power Query.

    Select all columns related to plotter services, and then select the Transform > Explode Only Selected Columns tab.

    Change attribute name > Plotter service type, Filter value only for "Yes". Delete the Value column.

    Now you can Close and Apply and create relationship 1 to many in your code and counting should be easy. Simply place the new plotter service in values such as a different count or count if you prefer.

1 Reply

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion
    Are Tracer Services columns, such as outpatient, hospitable, etc.?

    If so, I suggest you test a UNPIVOT of the data in Power Query, so click Transform Data on the Home tab to open Power Query.

    Select all columns related to plotter services, and then select the Transform > Explode Only Selected Columns tab.

    Change attribute name > Plotter service type, Filter value only for "Yes". Delete the Value column.

    Now you can Close and Apply and create relationship 1 to many in your code and counting should be easy. Simply place the new plotter service in values such as a different count or count if you prefer.