Subtract 2 text dimensions in Tableau - tableau-api

I wanted to know if it is possible to subtract 2 dimensions which are text fields. For eg.
Kpi Name Jun May Apr
$Deposits 234 567 321
Here I have Kpi name in rows and date in columns. Kpi_value is text.Is it possible to take difference between Jun value and May Value? If this difference is positive I want to put a colored shape next to it.
Thanks!

Related

Can I do a dynamic filter on various columns based on another one's value in spark 2?

I have to do a project in Spark 2 and I was wondering if I can (and how to) filter based on a dynamic selection.
Currently my Dataframe looks like that (there is several more columns in my code, not just age and colors):
filters (as tuple array)
color
age
target_value
[(age,5)(color,Blue)]
Pink
5
25
[(age,5)(color,Blue)]
Blue
5
27
[(age,5)]
Pink
5
30
[(color,Pink)]
Pink
12
28
And, for this example, I want the following output:
filters (as tuple array)
color
age
target_value
[(age,5)(color,Blue)]
Blue
5
27
[(age,5)]
Pink
5
30
[(color,Pink)]
Pink
12
28
I tried with the forall function but it is only available in spark 3.
The filters columns contains an array of key-value pairs where the value have to be checked for equality among the column with the key name. So I have to filter on a non deterministic number of rows with non deterministic value.
Can I do this kind of dynamic filtering with Spark 2 or is it impossible by design to select a column based on another column value for each line?

Different filter to axis X and Y

Type Value Year
1 2 1907
2 3 1907
3 1 1907
4 5 1907
. . . .
1 24 2021
2 41 2021
3 10 2021
4 81 2021
I want to make a scatter plot and with dynamic filtering in a dashboard, choose which type to plot in. But the problem is when filtering I can only make that filter affects both X and Y axis. How to make a filter to X axis and other for Y axis?
One solution is to create two parameters to ask the user which types to use for the x and y axes, both of type whole number. Show both parameter controls (right click)
The purpose of the parameter is to ask the user a question and record the response. Each parameter can have exactly one value at a time, even though it can have a list or range of possible values.
Then create a boolean calculated field to determine whether a data record should be included, such as X type = X parameter and Y type = Y parameter (Its not clear from your problem description what those criteria really are)
Then put your calculated field on the filter shelf, and only include data records where the calc evaluates to True.
I'm new to Tableau but I have never seen a filter used on anything except selecting which rows to process.
You can accomplish what you describe by having one sheet per X-axis field you want, normal filtering on the rows ( Y-axis) , and a parameter on a dashboard to pick which sheet to display.
https://help.tableau.com/current/pro/desktop/en-us/dashboards_sheet_selector.htm

Spotfire: Empty values on x-axis

Spotfire question: I have a data table with monthly data that is visualized in a bar chart. I however also want to visualize the information in quarters, by showing the latest month of the quarter in the format '20Q1, 20Q2, etc.'. (So I don't want to use standard 'date format'.)
My idea was to create an additional column that is filled for March, June, Sep, Dec and empty for the other months. Then with a document property, the user can select to either view the data in months or in quarters (i.e. the last month of the quarter).
So far so good, my data now looks like this:
Month
Value
YearQuarter
Jan-20
100
Feb-20
200
Mar-20
400
20Q1
Apr-20
125
May-20
101
Jun-20
300
20Q2
The problem now is that when I visualize the data with YearQuarter on the x-axis, it also shows all the (empty) values in a bucket. See below. How to solve this? Note that the x-axis has a custom expression "<$esc(${Granularity})>", where Granularity is a document property to determine what column to pick.
Did you try limiting your data with whatever expression you have put in x axis.
Thanks

Tableau stacked and side-by-side bar chart on column aggregation

I have a data set like this
Name Occupation Payment Principal Interest
Amy Nurse 100 90 15
Becky Teacher 80 100 20
Catherine Nurse 90 75 15
John Engineer 90 80 12
Tom Teacher 120 100 20
... ... ... ... ...
I'd like to create side-by-side(Payment) stacked chart:
Row: Occupations
Column1 : stacked(Sum of Interest and Sum of LP Principal) by occupation
Column2 : Only Sum of LP Payment by occupation
Can anyone give me hint how to make it?
Your data is not in the correct format for the required chart and you need to do some data prep.
Pivot all three measure fields from the data source page.
create a calculation to define the column for each data type
Build the chart as below and hide the header for column field.
One approach that avoids reshaping your data is to use the measure names and measure values placeholder fields to create the stacked bar chart.
See below

Google Line Chart customize x axis week number to month

I have some data that summarizes unit count by week by year. IOW's, my datatable looks like this:
Week/ 2012/ 2013/ 2014/ 2015
1/ 45/ 45/ 31/ 28
2/ 45/ 52/ 54/ 58
3/ 40/ 42/ 62/ 51
4/ 41/ 50/ 58/ 50
5/ 43/ 46/ 58/ 46
6/ 41/ 49/ 56/ 56
...and so on (sorry about the formatting). I am displaying this data in a Google Line Chart - multiple lines, one line for each year. My challenge is: how to display (alpha) months on the x-axis of the line chart? (Currently I get week numbers, which don't mean much to anyone!)
SEE COMMENTS BELOW FOR ANSWER
If your starting point is a dataset with "by week" data you wont be able to use it for displaying monthly data. Not accurately anyway.
What you really want to do is to change your query so as to get a dataset with monthly data.