Can I generate country in dimension in Tableau? - geocoding

I'm doing airlines analytics in Tableau. I only have airport names but not country names. Airport codes can be turned into geographic airport, so they're automatically drafted on a map. Then I want to filter out only US flights. Can I generate a country dimension based on the map so that I can select US?

Related

Power BI matrix to show unrelated table columns

I have a matrix in Power BI that shows sales and stock information from two tables, by year and region. Third table that contains article IDs and is linked to both tables and used as a slicer. I have also created another table with years and linked it to both tables as well so I could get both sales and stock information on the same matrix.
Sales table contains sales and qty by year and region, while stock table contains stock information only by year.
As a consequence, my matrix shows same stock information for all regions but I would like it to only show it for regions where we have sales (only Asia in example below). Since I do not have stock information by region in stock table but only by year, is there a way to make stock appear in matrix only in regions where we have sales data?
I was able to solve this using TREATAS function in DAX to connect two unrelated tables.

How to add a foreign key to Google Data Studio Blend

I have 3 tables and I want to get different data for a chart. First and second have a common key, second and third have a common key, but first and third does not.
EXAMPLE DATA:
TABLE product data
product ID
product category
TABLE orders
order ID
Product ID
sale price
TABLE order logistics
order ID
Client ID
Client's country
What I want to achieve is a graph that shows:
Sum of sale prices for all product in category "cars" bought by client from country "USA"
I know how to use filters and how to make graph, my problem is how to get my data together in one document.
I know that I can modify data and add lookups in Google Sheets but as my data has 100 000+ rows I am looking for a more efficient solution than vlookup between tables in Google Sheets.
So far I could Blend data only when common key was present.
Blend in Data Studio needs the same common keys for all data sources.
You need to do these joins in BigQuery.

Power BI Desktop - Map Visualization Problem (not showing all locations)

In an excel sheet I have several countries listed for different job ID (ex: USA, Canada, UK, UAE, etc). However, once I load the data into power BI and select the map visualization, only one country is listed on the map. How do I get all countries from the spreadsheet be labelled on the map?
Maps are a big problem in Power BI.
You should add latitude and longitude columns for every country into your country table.
There are some map specific issue in Power BI which basically belongs to the Map Provider, not a Power BI Issue. For example, in ArcGIS map you have to provide value "United States of America" instead of "USA". Other wise the map will not going to detect that country appropriately.
For your example cases you mentioned USA, Canada, UK, UAE. Here in most case I guess it is related to the country name. Please try with providing full name of countries. You can aslo search Map wise supported country name from their documentation.

Filtering plots in power BI on through column names

I have the following tables
I have several tables on coal consumption, natural gas, .....
I want to have a power BI model that can allow viewing these data with years (x-axis) while filtering on countries.
I have transposed the data to have a column with years and countries on the columns. But I cannot filter on countries.
Another thing I have done is to unpivot all the data and have four columns (country, year, value, fuel type) but the problem is that I could not manage to create suitable relationships between the tables as there is no primary key.
I have thought on putting all the data fro the different energy sources in one table. But how can I manage to link it to more data per country at year as well.
Another thing I have done is to unpivot all the data and have four columns (country, year, value, fuel type)
This is totally the right approach.
The next step required in minimum is to combine all unpivotted tables vertically into one EnergyConsumption table. You can utilize Append Queries command in Power Query Editor, or Table.Combine function in M language.
Additionally, you should consider to create three tables: Years, Countries, and FuelTypes, which have unique values of the respective dimensions, and establish one to many relationship with EnergyConsumption table.

Fetch list of cities from entered city and it direction using PHP

I have list of records with city name and it latitude and longitude.now i want to find a list of cities based on entered city and direction (north,south,east,west).e.g, if i enter city Mumbai and select dircetion east then it will display list of east side cities from Mumbai.so how to achieve this task.please if you have any solution then share it with me.
Thanks in advance.
A geographic location is expressed as its latitude (the distance north of the equator) and the longitude (the distance east of the Greenwich prime meridian).
Hence the scenario you describe is merely a matter of selecting the coordinates for Mumbai from your database, and then performing a separate query to return all cities with a higher longitude than the discovered value.
the logic is very simple, when the "select" tag containing the cities is "change"d, you need to send an ajax call to your .php file that retrieves the database values and ask it to find the selected city in the other table that contains the direction and list of the cities and then send them back to your .js file and place them in the desired select. with no code to show for, this is the only help I could give you!