Forum Discussion

ROLFUS's avatar
ROLFUS
Regular Visitor
2 years ago
Solved

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 bas...
  • BA_Pete's avatar
    BA_Pete
    2 years ago

     

    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:

     

    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