Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Using a power BI script for creating a calculated column, how can we convert a State Name Table into a State Abbreviation?
State Abbreivation = SWITCH (
[State Name],
"Alaska", "AK",
"Alabama", "AL",
"Arkansas", "AR",
"Arizona", "AZ",
"California", "CA",
"Colorado", "CO",
"Connecticut", "CT",
"Delaware", "DE",
"Florida", "FL",
"Georgia", "GA",
"Hawaii", "HI",
"Iowa", "IA",
"Idaho", "ID",
"Illinois", "IL",
"Indiana", "IN",
"Kansas", "KS",
"Kentucky", "KY",
"Louisiana", "LA",
"Massachusetts", "MA",
"Maryland", "MD",
"Maine", "ME",
"Michigan", "MI",
"Minnesota", "MN",
"Missouri", "MO",
"Mississippi", "MS",
"Montana", "MT",
"North Carolina", "NC",
"North Dakota", "ND",
"Nebraska", "NE",
"New Hampshire", "NH",
"New Jersey", "NJ",
"New Mexico", "NM",
"Nevada", "NV",
"New York", "NY",
"Ohio", "OH",
"Oklahoma", "OK",
"Oregon", "OR",
"Pennsylvania", "PA",
"Rhode Island", "RI",
"South Carolina", "SC",
"South Dakota", "SD",
"Tennessee", "TN",
"Texas", "TX",
"Utah", "UT",
"Virginia", "VA",
"Vermont", "VT",
"Washington", "WA",
"Wisconsin", "WI",
"West Virginia", "WV",
"Wyoming", "WY",
"District of Columbia", "DC",
"State not found message"
)
The above would go from state abbreviations to state name, all you need to do is reverse the arguments, it does work
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
56 | |
35 | |
27 | |
27 | |
26 |
User | Count |
---|---|
62 | |
51 | |
30 | |
24 | |
23 |