The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have this file I want PBI to analyze, I would like to make a monthly line graph from it. This is the whole file.
Year JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
1990 1191.00 1191.75 1189.56 1186.89 1183.93 1182.06 1179.49 1178.82 1180.02 1178.90 1178.54 1177.89
1991 1179.39 1180.06 1179.31 1177.80 1175.92 1174.67 1173.29 1172.92 1173.01 1171.73 1171.82 1173.44
1992 1177.25 1179.42 1180.31 1179.78 1177.31 1175.07 1173.92 1173.59 1174.44 1174.68 1175.45 1176.86
1993 1183.64 1189.88 1193.46 1193.04 1190.27 1188.27 1187.20 1188.41 1189.15 1188.05 1188.45 1188.75
1994 1190.09 1190.97 1188.51 1184.94 1181.64 1179.42 1178.97 1178.24 1178.40 1177.80 1175.67 1176.55
1995 1180.37 1182.58 1182.27 1179.68 1178.33 1179.03 1180.75 1181.70 1184.28 1186.12 1189.65 1190.92
1996 1193.45 1193.81 1193.81 1192.75 1191.26 1190.43 1190.26 1190.02 1190.84 1191.56 1192.71 1194.38
1997 1195.63 1196.51 1199.10 1200.01 1199.96 1202.32 1203.49 1204.52 1205.81 1209.64 1212.80 1214.64
1998 1214.40 1214.05 1214.26 1212.74 1211.59 1211.83 1212.43 1214.30 1214.78 1215.76 1214.79 1212.53
1999 1212.89 1213.30 1211.75 1208.80 1207.37 1206.40 1207.28 1208.74 1211.29 1212.11 1212.58 1213.94
2000 1214.26 1213.79 1211.33 1208.78 1207.67 1204.09 1199.97 1196.66 1196.72 1196.66 1196.45 1196.12
2001 1197.27 1196.62 1194.68 1190.76 1187.32 1183.12 1180.78 1179.97 1177.96 1178.03 1177.22 1177.37
2002 1177.94 1176.50 1172.06 1167.49 1162.39 1160.19 1157.57 1156.42 1155.42 1154.89 1153.30 1152.13
2003 1153.33 1154.42 1153.09 1148.27 1144.68 1143.19 1141.93 1143.27 1142.12 1141.17 1139.48 1139.12
2004 1140.39 1140.11 1138.70 1134.98 1129.70 1126.93 1125.73 1126.67 1125.86 1127.43 1130.13 1130.01
2005 1137.40 1143.25 1147.66 1144.45 1141.89 1140.46 1139.01 1139.61 1138.36 1137.01 1135.27 1137.52
2006 1139.46 1141.20 1139.48 1135.94 1131.14 1128.26 1126.42 1126.54 1125.36 1126.13 1126.63 1128.12
2007 1129.55 1129.35 1125.79 1120.69 1115.89 1113.50 1111.58 1111.84 1111.06 1110.95 1111.22 1114.81
2008 1116.46 1116.93 1115.65 1110.61 1107.05 1104.98 1104.42 1105.13 1105.76 1107.94 1107.33 1110.97
2009 1111.78 1111.43 1107.40 1101.26 1096.92 1095.26 1094.20 1093.73 1093.68 1093.26 1093.52 1096.30
2010 1100.02 1103.21 1100.66 1098.00 1094.30 1089.30 1086.97 1086.91 1083.81 1082.36 1081.94 1086.30
2011 1091.73 1095.78 1096.39 1095.76 1097.90 1102.38 1107.07 1113.45 1116.04 1121.00 1125.82 1132.83
2012 1134.18 1133.06 1129.41 1123.93 1119.38 1115.84 1115.92 1116.56 1115.16 1116.50 1117.24 1120.36
2013 1122.32 1122.14 1118.59 1112.91 1108.36 1105.98 1105.92 1106.13 1106.92 1104.04 1106.36 1106.73
2014 1108.75 1107.94 1101.71 1094.55 1087.46 1082.66 1080.60 1081.55 1081.33 1082.79 1083.57 1087.79
2015 1088.51 1088.98 1084.87 1079.03 1076.57 1075.08 1078.15 1078.31 1078.10 1078.99 1078.23 1080.91
2016 1083.68 1084.17 1080.45 1076.13 1073.80 1071.64 1072.75 1075.17 1075.23 1076.34 1076.55 1080.82
2017 1086.08 1089.78 1088.26 1084.89 1081.56 1079.52 1079.03 1081.44 1082.05 1082.30 1080.95 1082.52
2018 1087.50 1088.21 1088.11 1084.49 1080.00 1076.81 1077.43 1078.88 1078.29 1078.52 1078.32 1081.46
2019 1085.75 1087.97 1090.24 1088.95 1086.48 1084.71 1082.82 1083.45 1083.00 1082.61 1083.85 1090.49
2020 1094.68 1096.27 1098.59 1096.39 1091.32 1087.07 1084.63 1084.04 1083.21 1081.88 1081.07 1083.72
2021 1085.95 1087.26 1084.39 1079.30 1073.50 1068.77 1067.65 1067.96 1067.68 1066.77 1064.97 1066.39
2022 1067.09 1066.78 1061.49 1054.69 1047.69 1043.02 1040.92 1044.28 1045.03 1046.28 1043.02 1044.82
2023 1046.97 1047.02 1046.03 1049.69 1054.28 1056.39 1061.02 1065.35 1065.82 1065.34 1064.81 1068.18
2024 1072.67 1076.52 1075.35 1072.24 1067.08 1062.50 1061.49 1063.16 1063.71 1061.22 1060.89 1063.29
2025 1066.37 1068.18 1066.43 1062.23 1057.02 1054.98 1054.14
How do I make it one month per row like this:
1990-01 1191.0
1990-02 1191.75
1990-03 1189.56
etc.
Values can be comma delimited or tab delimited, it does not matter to me.
1990-01,1191.00
1990-02,1191.75
1990-03,1189.56
etc.
I have never done anything remotely like this. The data is not available in any other format.
Thank you.
Solved! Go to Solution.
I did it!
1. I got my data source from my lakemead.txt file.
2. In Power query on the Home tab bar I clicked "Use first rows as headers".
3. Then I selected all month columns.
4. On the Transform tab bar I clicked Unpivot.
My data source in PBI now looks like this:
Transform the data using Power Query:
Once the data is loaded, click on "Transform Data" to open the Power Query Editor.
In the Power Query Editor, select the first column (Year) and then click on the "Transform" tab.
Click on "Unpivot Other Columns" to transform the data from a wide format to a long format.
Format the data:
Rename the columns to "YearMonth" and "Value" for clarity.
To combine the Year and Month into a single column, add a custom column:
Click on "Add Column" and then "Custom Column".
Use the following formula to create the "YearMonth" column:
powerquery
= Text.From([Year]) & "-" & Text.PadStart(Text.From(List.PositionOf({"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}, [Attribute]) + 1), 2, "0")
Proud to be a Super User! |
|
I did it!
1. I got my data source from my lakemead.txt file.
2. In Power query on the Home tab bar I clicked "Use first rows as headers".
3. Then I selected all month columns.
4. On the Transform tab bar I clicked Unpivot.
My data source in PBI now looks like this:
A faster way to do that is to select the year then unpivot other columns. And then get the start of month equivalent of the year and month combination so it will be easier to do time intelligence. Custom column below combines month short, "1" and year into a date as text format before being parsed as date