How to filter dashboard based on quick filter values selected in Tableau ? - tableau-api

I'm having Dashboard-1 with the data source from SQL Server Table-A having columns
Col1,Col2,Col3
Now, i'm creating a new dashboard-2 with data source as Table-B having columns Col1,Col4,Col5.
But Col1 which is common in both these tables doesn't have common data.
Eg. Col1 from Table-A is having records till 100 and Table-B is having records from 101.Also, the data is not static, its keeps on increasing in Table-B , Table-A is no longer populating but we need the data from it.
Problem1-- How to merge two column as single column for filter in Tableau
Problem2-- in the dashboard i need to show single filter as a union of Col1 from both tables, if user select value <100 then Dashboard-1 will open otherwise Dashboard-2.
Can someone provide me a correct approach.

1) Instead of merging after you have brought the data in, try merging the data using SQL UNION.
2) If that's not possible, do the same after importing both the datasets into Tableau. For an example, try from this official link
3) Try different Joins to see which one works for merging your table columns:
4) If all the above fails, try setting up an Action Filter explained in this link. Essentially you have to use Tiled Containers instead of Floating Containers and set up a action filter using a custom Parameter. This custom Parameter will help display Dashboard 1 when user selects <100 in the filter(for example) and Dashboard 2 when user selects >100(again example)

Related

Ignoring space characters when linking tables

I’m experiancing a problem when trying to link to tables in the database expert. The two fields that link the tables have exactly the same information except one table always has an additional space. For example;
Table 1 = Multivitamin/Tablets
Table 2 = Multivitamin//Tablets
‘/‘ are representing spaces
Formulas won’t help (e.g. extractstring etc) as it’s the tables themselves I need to link together
This is preventing me from retrieving the information I need. Any advice on how I can get around this?
There are some ways to come across this:
Consider using a command as datasource instead of tables. When writing the query of the command you can define the join condition yourself.
If you have access to the data source, you could add a calculated field to the tables to contain the normalized field values and then use these for linking in CR.
Alternatively, one could create views in the database, either adding normalized "linking fields" or providing the joined tables results.
If it's only a few rows in CR, you could consider using SQL fields or subreports to retrieve data from Table 2.

Microstrategy Lookup Table join

Lookup table (State)
In this table I have 4 Columns (Region_id,RegionName,State_id,State_name)
2.Fact table
In this I have couple of Columns like(customer,product,date,Region_id,State_id,Revenue, Profit)
In lookup table there are more number of states whereas in fact we have data only for few states.
My requirement is to display all the sates in report even though there is no corresponding data available in fact.i have set the state table as lookup for state attribute.
If I pull the state attribute and a metric from fact and set vldb properties preserve lookup table then I'm getting all the sates and it's metric values and null for the one which don't have metric value.
Now If I add some attribute like customer or product along with it I'm not getting all the sates..I'm getting only the states which have data in fact since on adding some attribute the mstr is not hitting state table at all it's bringing data from fact itself.
What could be done so tat I can get all the sates and null even for the customer and product..?
You could try forcing your metrics to outer-join on the dataset itself while preserving final pass elements to make a left join.
Within developer, navigate to your dataset/cube and open it up in editable mode.
Select "Data" within the top bar of the cube/dataset editor >> Report Data Options >> Metric Join Type.
Here you will see your Metrics. Change the join type from inner to outer. Rerun the report and it should bring back all the data you need.
Let me know how it goes.

How to create queries dynamically based on filters selected in PostgreSQL?

I have a UI where products of various categories will be listed. There will be filters on various attributes which users can select to filter out the products. How should I create a query which will change dynamically based on the selection of filters? Further, once the result set is ready, only few rows to be displayed at a time to the user e.g. 10 rows at a time; value of which again will be decided by the user.
You could write a PL/pgSQL function that takes a JSON with filter fields and values and returns matching rows. But there are libraries for doing that, why not use one of them. What is your UI built on?
On pagination, see Five ways to paginate in Postgres

data merging in Tableau

I have two sheets in excel. One has CBG (neighborhood) IDs as shown below.
The second sheet has state and county names and IDs as shown below.
Now the first 5 digits in the CBG ID are just the corresponding state and county IDs for that CBG.
I need to to join this data together in Tableau so that I would have the state and county on the CBG sheet for each CBG.
Basically I tried to blend the data and it didn't work. I also tried to perform a join calculation using the 5-digit code in the second sheet and the LEFT function to extract the 5-digits in the CBG code but it didn't seem to work either.
To fix it, just needed to fix the Join calculation on both sides of the join.
Also, it seems that both variables to be joined need to be the same data type.
The data that you analyze in Tableau is often made up of a collection of tables that are related by specific fields (that is, columns). Joining is a method for combining the related data on those common fields. The result of combining data using a join is a virtual table that is typically extended horizontally by adding columns of data.
When joining tables, the fields that you join on must have the same data type. If you change the data type after you join the tables, the join will break.
Please go through the below steps for joining tables:
In Tableau Desktop: on the start page, under Connect, click a connector to connect to your data. This step creates the first connection in the Tableau data source.
In web authoring: Select New Workbook and connect to your data. This step creates the first connection in the Tableau data source.
Select the file, database, or schema, and then double-click or drag a table to the canvas.
Double-click or drag another table to the canvas, and then click the join relationship to add join clauses and select your join type.
Add one or more join clauses by selecting a field from one of the available tables used in the data source, a join operator, and a field from the added table. Inspect the join clause to make sure it reflects how you want to connect the tables.
When you are finished, close the Join dialog.
Thank you.

DAX SUMMARIZE function isn't respecting row-based security in my Power BI Model

I'm adding Row-level security to a Power BI model and it's working on all the normal tables, but there's a DAX table created from a SUMMARIZE that's ignoring the security. I've created a small model that reproduces the issue - am I doing something wrong here, or is this behavior intentional?
Here's my data model - "Raw Table" is just a manual table with some numbers in it and a filter column:
"DAX Table" is created with a SUMMARIZE statement that just makes it a copy of the manual table (since every row is unique anyways):
DAX Table = SUMMARIZE('Raw Table', 'Raw Table'[Number], 'Raw Table'[Filter])
Here's what the content of the tables look like when nothing is filtered:
I've added row-level security that filters the Filter table to just the "Show" records:
And through the join, this appears to filter the Raw table normally - when it's enabled, I can only see the rows with "Show" in them (as expected). However, the DAX table continues to show everything, even the filtered rows that I'm not supposed to see:
What am I doing wrong here? Since I'm not allowed (via RLS) to see the rows labelled "Hide" in the raw table, shouldn't those also be excluded from the SUMMARIZE statement? I realize that adding a slicer on the Filter table and slicing the Raw table doesn't impact the SUMMARIZE statement (I still see all the rows in that case) - am I just seeing the same thing here? Since I'm prevented from seeing these rows based on a security setting, I'd expect them to be hidden from my DAX as well.
Assuming I'm doing this correctly and this is intentional, how can I create a DAX table that does respect my security filters (as I need to do this in my full model)?
Here's a link to the testing PBIX file as well.
Calculated Tables (and columns) get calculated when the model is loaded, and materialized. Not at runtime.
You will need to connect that table to your model so security propagates there aswell.