Using a Power BI Scatter Chart to Visualize Control of Congress

In this post I will show you how I built this pretty chart that depicts which party controled each house of the United States Congress (the Senate and the House of Representatives) between 1968 and 1980:

Final Chart

The chart displays, per year, the party that controls each house and the relative majority under which control is held.  The first item is given by the color of the dots and the second by their size.  Hovering over any of the dots shows this:

Hover

I got the raw data from Wikipedia, and it looks like this:

Wiki

I had to format the data in a special way to build the chart, especially for the year-by-year continuity.  This is because elections are not held every year but are staggered.  In the Senate, seats are held for six years but elections occur every two years for approximately one-third of the seats.  In the House, elections are held every two years for all members.  So after some M programming and a bit of DAX I got it into this shape:

Data

To build the scatter chart, we need two measures, one for the X axis and one for the Y axis.  For the X axis, I used the Begin Year and for the Y axis the House Type (1 for Senate, 2 for House).   Using Controlling Party for the legend provided the colors and the size was given by the Majority Percentage.  This is the final configuration:

Configuration

The last touch was to use an overlaid text box to label the final Y axis:

Y Axis

As a final note, the Quick Insights feature of Power BI gave me the idea for this chart:

Control

View the complete report here.

Please follow and like us:

0 comments:

Leave a Reply

Your email address will not be published. Required fields are marked *