I work for a retailer and would like to create a map in Power BI for all of our stores and their 3 closest competitors, like the example below (Ideal Output). The blue dot is our store and the red dots are our competitors. Ideally, the map would change automatically when a different store is selected in a drop-down slicer. Please see the example data below (My Data).
Thanks,
Mark
Ideal Output:
My Data
Table 1: All of our stores. Very basic. Every store has its own unique number, along with basic store details including geocodes.
Table 2: All competitors. Every competitor has a unique number along with basic information including geocodes.
Table 3: Our stores and their 3 closest competitors.
Here's the solution that comes to mind for me. Create a new table that combines information from all 3 of the tables provided. It will be formatted like your Table 1 or Table 2, but with two new columns, Type and Slicer Store.
Type will specify whether the row is your own store or a competitor. Slicer Store will specify which rows should be displayed when that store's name is selected in the dropdown slicer.
Each row from your Table 3 will have 4 rows in the new table, one for each of the columns. The Slicer Store column in your new table will contain the Store Number from each row in Table 3. The Type column in your new table is self-explanatory.
You will end up with something like the following.
Number
Name
Address
Latitude
Longitude
Type
Slicer Store
JL123
...
...
...
...
Store
JL123
C1
...
...
...
...
Competitor
JL123
C2
...
...
...
...
Competitor
JL123
C3
...
...
...
...
Competitor
JL123
JL456
...
...
...
...
Store
JL456
C2
...
...
...
...
Competitor
JL456
C3
...
...
...
...
Competitor
JL456
C4
...
...
...
...
Competitor
JL456
Now for how to use it in Power BI. Create a single-select dropdown slicer using your new Slicer Store column. Then create your map visual using the rows in your new table. Use your new Type column as the Legend/Category. This allows you to color stores vs competitors differently in the visual.
Bing bang boom, you're done. Note that you may have "duplicate" rows for competitors in your new table. For example, if JL123 and JL456 were physically located right next to each other, then rows for C1, C2, and C3 would each appear twice in your new table. The Slicer Store would be different (JL123 or JL456) for these rows, though.
How you create the new table, either manually or with some sort of script, is the hard part.
Related
I have a SharePoint list containing a column with data type People or Group which can contain multiple people. When this list is imported into Power BI it appears as [Table] in the Power BI Query Editor.
When I expand this column (using highlighted button above), it creates multiple rows (which I don't want).
My goal is to preserve the row count of my table by converting all duplicate rows created by the expansion back to single rows with a delimiter between values. Has anyone found a way to consolidate this?
Data example
Original Data
ID
ColumnHeader
OtherColumns
1
[Table]
OtherData
After expansion
ID
ColumnHeader
OtherColumns
1
FakeEmail#email.com
OtherData
1
FakeEmail2#email.com
OtherData
Target output
ID
ColumnHeader
OtherColumns
1
FakeEmail#email.com# FakeEmail2#email.com
OtherData
*The delimiter can be anything (not neccesarily a #)
Assume you have a table like this.
Table (in green) contains data structured like this.
To achieve the concatenation you're after as follows:
Add a custom column with the following code.
Text.Combine([ColumnHeader][Column Header A],"# ")
I need to change the inventory category for a couple of account numbers and only for a couple of companies. The inventory category for these accounts are mapped based on the account number but need to be changed specifically just for two companies. I've tried to filter by the company number and then find/replace, which worked fine, but then I can't unfilter to bring back the rest of the companies. I can't change the category for just those account numbers because it is only different for just those two companies.
Lisa, Here's perhaps a simpler approach than where your current way is taking you.
If I begin with this table:
Then I add a column (Add Column -> Custom Column) with the following:
The formula uses an if statement to determine whether each row has a specific Account (Acct. 4) AND Company (Co. 8). If so, then 99 is returned as a new category value for that row of the new column. If not, then the original Inventory Category is returned as a value for that row of the new column. (Obviously, you would edit this formula accordingly, to support your account, company, and new inventory category values.)
Here's the result:
Then I could delete the original Inventory Category column and rename the remaining New Inventory Category column to Inventory Category.
I'm attempting to analyze idea submissions in Power BI where there is a column with multiple values separated by commas. Here is an example of the table layout (each row being a submission):
Key
...
Tags
1
...
Chat, Service, Dallas
2
...
Banking, IVR, Miami, Zelle
3
...
New York, Collections
...
...
...
The tags column has the data I'm trying to analyze and it's sorted in whichever order they are first entered in by the submitter so they don't follow a certain structure necessarily. Some submissions may have as little as 2 tags and some as much as 15. I'm trying to figure out a way to structure the data in a way that Power BI can analyze each tag (if that makes sense, I'm sorry I'm having a difficult time explaining).
For instance, I want to be able to see the number of submissions by department (like chat or collections). I know I can split the tags column and have a separate column created for each tag but the problem I run into is that the new columns created have different values in each row depending on the order. For example, the new table after splitting the tags column would look like this:
Key
...
Tag1
Tag2
Tag3
Tag4
1
...
Chat
Service
Dallas
2
...
Banking
IVR
Miami
Zelle
3
...
New York
Collections
...
...
...
...
...
...
As you can see, the Tag1 column has mixed values in the sense that row 1 and 2 contains a department (chat and banking) but row 3 contains a location (New York). I suppose the question I'm trying to ask is if anyone has any recommendations on how to better analyze the tags so I can answer questions like:
What departments are sending in more submissions than others?
Which site locations are sending in more submissions?
I appreciate any help and advice. I hope this makes sense!
I'd suggest expanding to new rows rather than new columns.
Then your data looks like this
If you have a table of tags where each one is categorized as "Department" or "Location" or whatever, you can then merge that table onto the one above to have a nice Category column to help filter in your reporting.
I am fairly new to powerbi and I need your help in one task on which I am stuck on.
Basically I have two tables and I need to compare the value from table one with a row of table 2 and return the output.
Table 1
I need to compare values in column a & b and get a match from table 2.
For example if row 1 has BY Green & BS HIGH then I need to check this value from matrix table below and return the output in column value as either 0 or 1.
Table 2
As you can see the Table 2 first row has value BY Green and BS low has a value '0'
Try this...
Index() returns a value from the matrix (in purple) based upon the intersections of the two match()'s. The first is the Vertical match in from the Table1:Col A; the second is the Horizontal match from table1:Col B. The value found at that intersection is returned.
... My apologies ... just saw this was a BI request... no worries...
First, Need fixup table2 as a lookup file:
First, click a cell in table 2 (don't edit), then Data menu >frm table/range, will bring up the Power Query window. Select columns B (not A) through Col F), then in the PQ Transform menu > Unpivot to create the new lookup table. this can either be saved as a new table or be used by reference.
Next, open and merge Table 1 PQ_Table 2 (Be sure to select BOTH Columns in BOTH Tables, in the same order). Then, expand the table tab following the merge expand the table tab. I only selected the value to return but you can return all the values to verify, then delete the unneeded columns.
Hope this helps...
Good Luck.
I have two questions:
I have two tables, table1 and table2. I need to design an application in such a way that a selected row of table 1 when clicked should get displayed in table 2.
How do I call a custom table? Suppose I have a class Table with empty constructor and I will pass arguments like Table(pagination). It has to show the table with pagination,
Similarly, Table(lazyloading) has to show lazy loading table. Table(pagination, Lazy loading,search) must show all three properties.
What you have to do for nr 1 is that you attach a Clicklistener to your table1 and on a Clickevent you take the selected Object ni table1 and add it to table2. Also add an if to not add rows that already exist in table 2.
This is how you copy data
public void copydata(){
Object o = table1.getValue();
if(!table2.getItemIds().contains(o))
table2.addItem(o);
table2.setContainerDataSource(table2.getContainerDataSource());
}
When it comes to your second question I have no clue what you are talking about, but I looks like you want to extend the Table class in vaadin to get your own features.