Forum Discussion

way0utwest's avatar
way0utwest
New Member
10 years ago
Solved

Compare two sets of data

This is probably simple to do, but I'm struggling a bit to compare two sets of data that have similar structures in a single chart.

 

I'm obfuscating, but let's say I've got a set of data for person a, which is something like this:

 

TimePeriod, Weight

1, 190

2, 192

3, 195

4, 194

5, 196

 

I've got similar data for Person B.

TimePeriod, Weight

1, 180

2, 182

3, 185

4, 184

5, 186

 

If I want to somehow compare these two in a chart, showing two lines, I can't quite figure out how to pull this together. Certainly I can add columns with percentages or other normalizing values, but to get the data from two sets, with a common column, whether integer or time, doesn't seem to work for me.

 

Ideas?

  • Try and merge the data together in Power BI or upstream so it looks like this:

     

    TimePeriod, WeightA, PersonID

    1, 190 ,A

    2, 192 ,A

    3, 195, A

    4, 194, A

    5, 196, A

     1, 180,B

    2, 182, B

    3, 185, B

    4, 184, B

    5, 186, B

     

     

7 Replies

  • SqlJason's avatar
    SqlJason
    Icon for Memorable Member rankMemorable Member

    Ideally, you should append those 2 datasets, with one more column specifying person. So now, your table structure will look like

    Person, TimePeriod, Weight.

     

    Once you have this, you can put the TimePeriod on axis, Person on Series/Legend and Weight on Values, and then you will get a line chart that can be used for comparison

  • pqian's avatar
    pqian
    Icon for Microsoft Employee rankMicrosoft Employee

    We don't support plotting unrelated data sets in one chart (probably doesn't make a lot of sense in BI), so you can do what SqlJason said to combine your data into one table, or create a relationship between the two sets (using TimePeriod as key) and plot them on a line chart.

    • Phil_Seamark's avatar
      Phil_Seamark
      Icon for Microsoft Employee rankMicrosoft Employee

      Try and merge the data together in Power BI or upstream so it looks like this:

       

      TimePeriod, WeightA, PersonID

      1, 190 ,A

      2, 192 ,A

      3, 195, A

      4, 194, A

      5, 196, A

       1, 180,B

      2, 182, B

      3, 185, B

      4, 184, B

      5, 186, B

       

       

      • way0utwest's avatar
        way0utwest
        New Member

        Thanks, I tried that, but couldn't get it to visualize or slice correctly.

         

        The merge worked, and I'll mark that as a solution.

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi way0utwest,

     

       you want to compare these two dataset in a chart showing two lines right?

    Because if you do not want to merge the two dataset, you can just add a relationship between them:

     

     

    Then using the Line Chart visualization you can plot this:

     

    to observe the changes between them.

    Let me know if it works.

     

    #I'M Not An Expert#

    • valQuentine's avatar
      valQuentine
      Frequent Visitor

      Can you toggle ON/OFF the compared charts? Say, I want to show one dataset in the same chart and compare it with another (with the option to turn it ON/OFF).