Google Data Studio - Column Chart - date

I would like to create a column chart, in GDS, that compare the monthly income versus unpaid amounts.
In short, what was received versus what was not received and, what was not received, be added to the subsequent month.
Follow below how I parameterized the dashboard:
Datarange dimension: NULL
Dimension: Due_date
Detailed dimension: I used a calculetad field to generate the open values and amounts paid. See below:
''CASE
WHEN Due_Date < Pay_Date OR Pay_Date IS NULL THEN "Open"
ELSE "Paid"
END''
Metric: I calculate the total sum of payments: SUM(Bill_value)
Classified by: Due_Date
Secondary Classification: I used the same dimension of Detailed dimension
So, I think that the Detailed Dimension code is wrong.

Related

LoD for subtraction

Hello I have a question about using LOD For subtraction in tableau.
I have a table with different dimensions such as customer name, sales group, distribution center and measures that I need to work with is subtracting products that was SHIPPED from FORECAST using LOD TO Compute this and get a percentage difference between the two measures using those dimensions.
Can you help?
Let's say you have a measure called Amount. You can get the Total Amount by Customer Name:
{ FIXED [Customer Name] : SUM[Amount] }
And let's say you have another measure called ForecastAmount. You can get that total by Customer Name:
{ FIXED [Customer Name] : SUM[ForecastAmount] }
So if you create two calculations using those formulas, you'll have the basis for your percentage difference. The formula for percentage difference is:
ABS([LOD Amount] - [LOD ForecastAmount]) / (([LOD Amount] + [LOD ForecastAmount])/2)
(and then format that result as a percent, or multiply it by 100).
You can apply the same logic to your other dimensions.

Code to compare the number of "false" to total number of cases

I am trying to create a chart in tableau which will show me the comparison in weeks, i.e. the comparison between the trend from week 1 to week 5.
In simple terms it should be like:
If Verdict = "Not Reversing" THEN count the total number of Verdicts
Else do not count
If IF [Verdict] = "Not Reversing"
THEN
COUNT([Verdict])
END
IF [Verdict] = "Not Reversing"
THEN
COUNT([Verdict])
END
Error message shows cannot mix aggregate and non aggregate functions
Assuming your data source has exactly one data row per verdict ... (Always be clear about what one row in your data source represents.)
You could define a calculated field called Number of Non Reversing Verdicts defined as INT([Verdict] = "Non Reversing") That field will have the value 1 for Non Reversing verdicts and 0 otherwise. The INT() function converts its arguments into an integer, and treats TRUE as 1 and FALSE as 0.
You can then plot SUM([Number of Non Reversing Verdicts]) as desired, along with SUM([Number of Records]) to see the total number of verdicts -- or even compute the ratio of the two formatted as a percentage.
For extra credit, you could rename the predefined field [Number of Records] to [Number of Verdicts] for this data source if that helps make it more clear. (BTW, look at the definition of [Number of Records] and make sure you understand why that works)

Compute average (with condition) in Tableau

Wanted Result: Average of the turnover value on days that are between the start and end reference period.
Using Tableau Desktop
Lod expression
The first step is i return the turnover value on days that are between the start and end reference period, and return null otherwise.
Daily Turnover in reference period
IF [Date]>= [Start reference date]
and [Date]<= [End reference date]
THEN [Amount] END
Second Step is to calculate the average across this range of values for each product.
Average Turnover in reference period
{FIXED [Product]: AVG(Daily Turnover in reference period)}
Here a screen shot
The average must be 2331 and not 24.
Really i need HELP.
Thanks.
There are multiple possible approaches, here is one.
Define an LOD calc as Daily_Amount_Per_Product
{ FIXED Product, Date : SUM([Amount]) }
Put Date on the filter shelf and select the range of dates you want to analyze. Put Product on the Rows shelf and put Daily_Amount_Per_Product on the Columns shelf.
At this point you are almost, but not quite done. Since your LOD calc as at a deeper level of detail (has more dimensions in play) than your view, Tableau will perform aggregation to get a result at the same level as your view - which is why you see the word SUM before your field on the Columns shelf. If you want to see the average instead of the sum, change SUM to AVG and you should have your result.

Execute IF-THEN_ELSE before Execute Calculation - Tableau

I have a graph below.
I would like to calculate lapsed rate which is sum of lapsed value divided by sum of inforce value. I use the formula below in calculated field.
abs(sum(if[Status]='lapsed'then[TotalAmount]end))/abs(sum(if[Status]='inforce'then[TotalAmount]end))
However that formula will also pick the value from Q2 (quarter 2) 2016. What I want to do is to tell tableau to check first if any quarter does not contain both inforce value and lapsed value then skip that quarter. In this case I need to calculate lapsed rate which does not include Q2 2016. How do i do this?
I'm using Tableau v.10.
Thanks.
This is just a quick approach and may not be the most efficient but it seems to work.
You need to use a combination of a row level calculation and a level of detail calculation.
The level of detail calculation can be used to flag the quarters which have both a lapsed and inforced status. Once these quarters are flagged you can calculate the lapsed rate at a row level which can then be rolled up using a sum.
Create a calculated field as follows:
Let me know if you have any questions or need any tweaks.
if
avg(
// Calculate the number of Inforce/Lapsed occurences per Quarter
IF
[Status] = 'Inforce'
or
[Status] = 'Lapsed'
then
{ FIXED
DATEPART('quarter', [Date]):
countd([Status])
}
else
0
end)
//
= 2
then
// Calculate the Lapsed Rate as both statuses exist in the quarter
sum((if
[Status] = 'Lapsed'
then [Total Amount]
END))
/
sum([Total Amount])
END

Pick group totals, grand totals and normal summarization in Tableau

I am trying to calculate average of 2 columns in another column in Tableau but difficult part is grand total is not getting average instead it is the sum of 3rd calculated field.
A B Calculated field
10 5 2
6 3 2
T 16 8 4 (Here I should get 2 instead it is taking sum of column)
Here I am unable to write separate formula for row totals and grand totals, Only one formula (Calculated Field) is allowed and when I am dragging on sheet it is by default aggregating to sum.
Note: I am expert in Crystal and BO but beginner in Tableau.
Update
Code used for LoD
{FIXED [Product Category]: AVG([Sales])}
Below image is what I got after implementation I have tried with 2 columns but the result is same if I use only one column (I am trying to get the average of sales)
You are almost there - the Grand Total by default does a SUM function you just have use the Total All Using --> Average option.
Output : Level wise SUM(Profit) later averaged across columns and rows. (Show Column Grand Total & Show Row Grand Total active)
Update: Answering the question below. To get the Row-wise avg (which is Cat1-vag in this case) you could just drop the measure and change it to AVG(). Since you needed in a Calculated Field you could use a Simple FIXED LOD. You can also uncheck aggregated measures from Analysis dropdown and have no Dimension in column or row like unlike what this example shows and still get three different averages. Cheers.
{FIXED [Cat1]:AVG([Profit])}
Check out this very smart work around from Joe Mako.
https://community.tableau.com/thread/112791
create a calc field like:
IF FIRST()==0 THEN
WINDOW_AVG(SUM([Sales]),0,IIF(FIRST()==0,LAST(),0))
END
duplicate your Category field
place "Category (copy)" on the level of detail
set the compute using for the calc field pill to use "Category (copy)"
The window function in the calculated field only takes into account what's in the view, and aggregate based on those number.