Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ROLFUS
Regular Visitor

PowerBI

I have a data set with machine types, say A, B, C, D, and E. Then I have a data set for the service team where some can only service a specific machine type, but others can service multiple types based on their skill set.
Now, I want to display where the machines and technicians are on a map and create a table showing the machine type-to-technician ratio.
I can't get it to work since it has only one type in the machine data, but it could be A, B, or even more in the tech data.
Is there a way to do such an analysis?

1 ACCEPTED SOLUTION

 

Ok, I think I understand what you're going for.

 

See attached an example PBIX below. What I've basically done is:

 

-1- Split out your A/B, C/E etc. Techs into new rows in Power Query.

-2- Also in Power Query, created a new dimTech table, that just contains a unique list of all the Tech Codes (A, B, C etc).

-3- Related the new dim table to both Machines and Technicians tables.

-4- Created the following measures:

 

_noofMachines = DISTINCTCOUNT(machine[Serial Number])

_noofTechnicians = DISTINCTCOUNT(technician[NAME])

_machineToTechRatio = DIVIDE([_noofMachines], [_noofTechnicians], 0)

_techToMachineRatio = DIVIDE([_noofTechnicians], [_noofMachines], 0)

 

-5- Using dimTech[techCode] in the visual, it gives the following output based on your example data provided:

BA_Pete_0-1698935247676.png

 

In terms of getting this working on a map visual, you'll need to create dimension tables for Country/City/Zip etc. and relate to both tables in the same way as dimTech. It might be cleaner if you just create a location code in each of the fact tables, then your dimLocation table can have [locationCode], [Country], [City] etc. to be plotted on the visual.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

7 REPLIES 7
ROLFUS
Regular Visitor

Hi Pete,

Serial NumberTECHCityStateZipCountry

Machine001AWOODBRIDGEONL4L3T1CANADA
Machine001AMUSKEGONMI49444USA
Machine003BBEDFORDIN47421USA
Machine004BWEST JEFFERSONNC28694USA
Machine007CPULASKIVA24301USA
Machine008CPORT HURONMI48060USA
Machine008DMAPLE GROVEMN55369USA
Machine008DBERKELEYMO63134USA
Machine008EANKENYIA50021USA
Machine008EGLASGOWKY42141USA

 

NAMETECHCITYSTATE/PROVINCEZIP CODE/POSTAL CODECountry

TECH001AGilbertAZ85297USA
TECH018AKISSIMMEEFL34744USA
TECH015A/BSt. CloudFL34769USA
TECH023A/BWaukeganIL60087USA
TECH008A/CSanta AnaCA92704USA
TECH009A/CCypressCA90630USA
TECH056A/CRussellvilleOH45168USA
TECH057A/CNorth RoyaltonOH44133USA
TECH062A/CDundalkONN0C 1B0CANADA
TECH074BBaxterTN38544USA
TECH081BGrahamWA98338USA
TECH083BWheelingWA26003USA
TECH050CConcordNC28027USA
TECH076CHoustonTX77062USA
TECH011DWillingtonCT06279USA
TECH012DBristolCT06010USA
TECH047DMorgantonNC28655USA
TECH048DHuntersvilleNC28078USA
TECH005D/BPerrisCA92571USA
TECH030D/BPlymouthIN46563USA
TECH082D/BPort OrchardWA98367USA
TECH026EPalatineIL60074USA
TECH027EHoffman EstatesIL60169USA
TECH037A/ELake OrionMI48360USA
TECH038A/ECambridgeMN55008USA
TECH054ESpringboroOH45066USA

 

Thats what im looking for. The data are not right because the data dont match

ROLFUS_0-1698864972949.png

 

Thank you.

Rolf

Hi Rolf,

 

Can you give me examples of your expected outputs please?

I need to know what the correct output looks like in order to work out how to produce it from your data.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hello Pete,
Below is the output I'm looking for, but the problem is that the technician count per machine is incorrect. The technician total in the left table is 79, but if you count the tech per the machine types, there are only 67 because the ones who can serve more than one type are not counted.
What I'm looking for is that the technicians who can do multiple types are counted on the types they can support (at least to 50%).

ROLFUS_0-1698925373339.png

Here is a sample what I want to have. I hope that helps

MA TypeMachinesTechnRatio MA/TECH
A13315.58.58
B25741.56.19
C4313.53.19
D123.53.43
E2254.40
Grand Total46779 

 

Rolf

 

Ok, I think I understand what you're going for.

 

See attached an example PBIX below. What I've basically done is:

 

-1- Split out your A/B, C/E etc. Techs into new rows in Power Query.

-2- Also in Power Query, created a new dimTech table, that just contains a unique list of all the Tech Codes (A, B, C etc).

-3- Related the new dim table to both Machines and Technicians tables.

-4- Created the following measures:

 

_noofMachines = DISTINCTCOUNT(machine[Serial Number])

_noofTechnicians = DISTINCTCOUNT(technician[NAME])

_machineToTechRatio = DIVIDE([_noofMachines], [_noofTechnicians], 0)

_techToMachineRatio = DIVIDE([_noofTechnicians], [_noofMachines], 0)

 

-5- Using dimTech[techCode] in the visual, it gives the following output based on your example data provided:

BA_Pete_0-1698935247676.png

 

In terms of getting this working on a map visual, you'll need to create dimension tables for Country/City/Zip etc. and relate to both tables in the same way as dimTech. It might be cleaner if you just create a location code in each of the fact tables, then your dimLocation table can have [locationCode], [Country], [City] etc. to be plotted on the visual.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hello Pete,

 

I did change the distinctcount of the machines to count because i needed the total of machines per tech code.   

Thank you for the help. 

Rolf

 

Cool, glad it (almost) worked for you 🙂

If you don't need to count unique items in your tables, just the total number of rows, then I'd probably swap DISTINCTCOUNT(table[column]) for COUNTROWS(table), rather than using COUNT.

Depending how large your actual dataset is this may give you some performance improvement.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




BA_Pete
Super User
Super User

Hi @ROLFUS ,

 

Please provide anonymised example data of both the Machine Types and Technicians tables, as well as examples of your expected outputs please.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors