Forum Discussion

Josef's avatar
Josef
Icon for Helper I rankHelper I
6 years ago
Solved

Data model from flat SCV file in Power BI Desktop

Hi guys, 

 

I'm still fairly new to Power BI and I run into a problem that I cannot solve by myself. Also not after doing a lot of research on the internet. 

 

It concerns this situation: I created an SCV export from an energy system with multiple divices, that looks like the next example data. The devices have simular signals, but the signals are in different columns:

CSV export data

DateTemperature - Device 1Wind - Device 1Temperature - Device 2Wind - Device 2
01-01-2016,514,216,416,9
02-01-2015,215,815,315,1
03-01-2013,112,213,512,8

 

My end goal is to create a table/overview with the device and wind per date, something like this:

DateDeviceWind
01-01-20Device 114,2
01-01-20Device 216,9
02-02-20Device 115,8
02-02-20Device 215,1

 

To be able to do this, I already made a copy of the table, split it into 2 different tables and change the column names:

 

Device 1

DateTemperatureWind
01-01-2016,514,2
02-01-2015,215,8
03-01-2013,112,2

 

Device 2

DateTemperatureWind
01-01-2016,416,9
02-01-2015,315,1
03-01-2013,512,8

 

Also I created this 'Devices' table by hand

Devices

DeviceIdTitle
1Device 1
2Device 2

 

If I'm not wrong, the final table should look something like this, where the deviceId is connected to the devices table:

DateDeviceIdTemperatureWind
01-01-20116,514,2
01-01-20216,416,9
02-01-20115,215,8
02-01-20215,315,1
03-01-20113,112,2
03-01-20213,512,8

 

Is this correct? And how can I achieve this in Power BI Desktop?

Any help is greatly appreciated! Many thanks in advance. 

 

  • Hi Josef ,

     

    You can follow these steps in the power query editor:

    1.Select the date column and unpivot other columns

    2.Split the column by "-"

     

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

  • Josef's avatar
    Josef
    6 years ago

    V-lianl-msft & amitchandak many thanks for your reply! I'm tried the unpivod option, but this didn't get the desired result for me.

     

    I not sure if it is the most efficient way, but I did the following what solved the issue for me:

     

    I copied the table two times. In the first copy I only kept the columns of device 1 and in the second only for device 2. Then 1 added a custom column 'deviceId' to both tables, for device 1 I put '1' in the custom column and for device two '2'. 

     

    Then I merge the two tables with Compbine > Append Queries as New, to create a new table where all the device data has the same columns, and the data from each device is distinguishable from each other by the deviceId. 

     

    For me the issue is now solved. Again many thanks for your replies!

5 Replies

  • V-lianl-msft's avatar
    V-lianl-msft
    Icon for Community Support rankCommunity Support

    Hi Josef ,

     

    You can follow these steps in the power query editor:

    1.Select the date column and unpivot other columns

    2.Split the column by "-"

     

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

    • Josef's avatar
      Josef
      Icon for Helper I rankHelper I

      V-lianl-msft & amitchandak many thanks for your reply! I'm tried the unpivod option, but this didn't get the desired result for me.

       

      I not sure if it is the most efficient way, but I did the following what solved the issue for me:

       

      I copied the table two times. In the first copy I only kept the columns of device 1 and in the second only for device 2. Then 1 added a custom column 'deviceId' to both tables, for device 1 I put '1' in the custom column and for device two '2'. 

       

      Then I merge the two tables with Compbine > Append Queries as New, to create a new table where all the device data has the same columns, and the data from each device is distinguishable from each other by the deviceId. 

       

      For me the issue is now solved. Again many thanks for your replies!

      • V-lianl-msft's avatar
        V-lianl-msft
        Icon for Community Support rankCommunity Support

        Hi Josef ,

         

        It's glad that you have solved your problem.
        Please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

         

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