Forum Discussion

Barcabarn7's avatar
Barcabarn7
Regular Visitor
6 years ago

Zip Codes in Multiple Service Areas

Hi everyone,

 

I am working with market share data in which a single zip code exists in multiple service areas that aren't mutually exclussive. I'd like to have a table that shows the following

 

Market A - Total Sales

Market B - Total Sales

Market C - Total Sales

 

44102 exists in both market A and B, I'm intending to map the totals to both market A and B. 

 

44102 - Market A

44102 - Market B

44103 - Market A

44104 - Market C

Etc...

 

Ultimately, this relationships will be used to create a filter (which I can do already), but also display visual variances that includes totals that'd show duplicative totals for 44102 shown in both market A and B and I'm stumped!

 

Any help would be greatly appreciated!

6 Replies

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    Can you create a unique MarketZip column in each? In Power Query just add a new column with the formula [Market] & [Zip Code] and make it text. Do this in both tables.

    You then have fields in both your Market table (top) and Zip code table (bottom) that you can join. It is a 1:1 so bi-directional filtering is automatic here.

     

     

    • Barcabarn7's avatar
      Barcabarn7
      Regular Visitor

      Thank you! 

       

      I might not be proficient enough with powerquery to figure out how to concatenate the zip code from my data table with the market shares. 

       

      For example, here's a sample of my data table:

      1.

      Zip CodeSales
      4411125
      4411235
      4411345
      4414455
      4411135
      4411250
      4411360
      4414480
      44111100
      44112200
      44113300
      44144400

       

      And the zip code market map that our company uses. (I ignore the primary secondary, eg 44111 = Market A, and Market B). 

      2.

      Zip CodeMarket AMarket BMarket C
      44111PrimarySecondary 
      44112 Primary 
      44113Primary  
      44144 PrimarySecondary

       

       

      I can make the unique key and unpivot the Zip-Map, but I can't figure out how to get the unique "zip - market" key in the 1st data table?

       

      Thank you so much!

      • edhans's avatar
        edhans
        Icon for Community Champion rankCommunity Champion

        Now that I've seen your data I would take a different approach. I can get this matrix, which to me seems not super informative, but it does correspond to the data you gave, as every zip has every market.

        I created a model that looks like this. In Power Query I created a Zip Dim table that will control both the Zip sales and Market Fact tables.

        See my PBIX file.

        If you need further help, can you let us know what your end goal is? I feel like I am doing a bit of guessing as to where you are going. In other words, "I have this data, how can I get this visual?" vs "I have this data, and need to do this to it" when "this" may not get you to your goal. Make sense?

         

        How to get good help fast. Help us help you.
        How to Get Your Question Answered Quickly
        How to provide sample data in the Power BI Forum

         

  • negi007's avatar
    negi007
    Icon for Community Champion rankCommunity Champion

    Barcabarn7  There is a workaround but not sure if it is what you want to achieve. Create a calculated column by combinaing zip code and market and then use this column in the legend and sales volume in bubble size as below