Zero Currency (Euro) defined field tested for 0 not recognised as 0 - calculation

I have a table of invoices with Invoice Amount HT, TVA, and Invoice Amount TTC all defined as Currency, Euro, decimal place auto. I assumed that being defined as Currency, Euro, there could only be 2dp. However, although all these amounts are displayed in the table as 2dp, if I click on the field it shows in some cases as more than 2dp. So, for example, looking at the table datasheet view, I have an invoice with Amount HT of €550.32, TVA of €110.06 and Amount TTC of €660.38 which all looks fine. But if I select these fields I notice that the TVA field shows as 110.064 and the Amount TTC shows as 660.384. When a payment is received it is added to the Amount Paid field (also defined as Currency Euro), and the Balance field (also defined as Currency Euro) is calculated as Amount TTC - Amount Paid. If the Balance is 0, I set the Completed Date to the date of the payment. The problem is that with this case it didn't recognise the Balance as 0 because it treated it as 0.004. This causes the case to be omitted from my Completed Sales Report. When TVA is to be added, it is calculated as Amount HT*0.2 (the TVA Rate). It is this calculation that is creating the problem.
Is there a way of avoiding this please?

Related

How to not take Null values while doing table calculation but keep them for the aggregated total

Background:
I have a cohort analysis table that shows month of year on the Y axis (Rows) and Difference from next month as my X axis (columns). With Customers as my measure, you see values from 0 to 12 on the column side, showing all the conversions from that particular month and people who did not make a conversion are shown as Null.
Problem:
As I have a table with column showing Null, 0,1,2... 8 showing values, and the total of this shows me my cohort size. So as a customer, Null is important as it shows the size of the total group. But I want to have a percentage of each group and show the cumulative growth of the group without taking the null group.
Summary
I want to show a cumulative percentage growth but not take my first column (that is the null values) but keep it to have the totals show correct value.
The following image can help you understand
For January 2022,
You have the total value of each column
You see the individual percentage of that column/ total
You see the cumulative percentage growth total
Result to see: if we can do cumulative percentage total without taking the Nulls.
Follow up Clarification from Image:
The expected answer should look like this
For 0 --> 3.9%
For 1 --> 7.8% (3.9%+3.9%)
For 2 --> 9.5% (3.9%+3.9%+ 1.7%)
As you can see, the percentage value takes the total cohort size and shows the 3.9%,which is the correct value and doing cumulative by excluding the Null value % that is 87.1% (therefore hiding the Null value column)

In Tableau how do I use RANK to calculate an "OTHER" field?

I'm new to Tableau so this may be an easy question about computations using RANK. I can't find any tableau HELP or other stack-overflow answer to this. Maybe this is a GROUP question. Maybe it's about OTHER.
I have a data set of 160 countries ( rows ) with a field for jetfuel consumption for each country.
I just want to make a bar chart like the attached image showing the 20 highest fuel-consumption countries by name ranked by jetfuel_consumption ( I can do that much) AND an 21st row computed country name titled "Rest of world" summing the remaining 140 countries together as if it were just another country like the bottom of this model .
I have a working valid computed field labelled "myrank" = RANK(AVG([Jetfuel Consumption]),'desc')
My thought was to simply calculate a new text field that would equal the country name for rank < 21 and then be the string "Rest of World" otherwise.
Such as:
IF ( [therank] < 11 ) [Country] ELSE "Rest of World" END
But that is not valid for an unspecified reason. I know I'm confused already about how to just specify the value of a field without something like SUM or AVG or AGG wrapping it, but this is a larger question.
What's the right way to make this view?
I've created simple dataset:
And I want to group TOP 3 countries by Consumption.
To do it I should create a set (click on Country in Dimension) and select TOP 3 By SUM(Cosumption):
Then create a calculated field to show Countries IN Set and "Others".
IF [Country Set] is a boolean expression "The country IN a set".
Drag and Drop corresponding fields and configure sort, for example:
Sets are convenient to dynamically change, expand and customize any visualization. More detailed: https://help.tableau.com/current/pro/desktop/en-us/sortgroup_sets_topn.htm

Tableau calculating variances (division) of two calculated (countif fields)

Tableau is giving me a hard time, trying to compare two items by percentages. I need to display the percentage different between the number (couintif) of string items based on condition.
Basically, I wrote two calculated fields like:
Calc field #1
IF [Outcome] = "Complete" Then 1 Else 0
Calc field #2
IF [Outcome] = "Pending" Then 1 Else 0
and a third field to get the percentage of pending sales to completed sales
Calc percentage
SUM(Calc field #1 / Calc field #2)
But it's not working. The first two fields work fine, validated them with dataset, but the third calculation doesn't work and always outputs 0
The formula for Calc percentage should be
SUM(Calc field #1) / SUM(Calc field #2)
As both the calculated fields are computed row-wise, it is important to aggregate while using it in a formula.

Tableau creating calculated field using filter

i have a table in tableau and i wanna create a calculated field based on a filter. Can someone help me in finding the solution for the following logical statement.
I have a table which contains some customers. It also contains some special customers say 'members'. Now I wanna show the total amount of billing for members customers and total amount for the remaining ones.
I have special range for these member customers ID. Ids lies between 300 and 399, both inclusive.
Please help. Thanks in advance
I assume that the measure you want to sum is the Customer Pay. Then, you can do this in three neat steps.
First Step: Create a calculated field called 'Customer Type'
IF [Customer Code] >= 300 AND [Customer Code] <= 399 THEN 'Member' ELSE 'Normal' END
Second Step: Create a calculated field called 'Member Total Billing Amount'
SUM(IF [Customer Type] = 'Member' THEN [Customer Pay] END)
Third Step: Create a calculated field called 'Non-member Total Billing Amount'
SUM(IF [Customer Type] = 'Normal' THEN [Customer Pay] END)
You can now drag Member Total Billing Amount and Non-member Total Billing Amount measures into the view as desired.
Note:
The calculated field called 'Customer Type' will be saved under Dimensions. So, go up there and look for it.
I have only named the calculated fields for illustration purposes. Feel free to change it to what is more intuitive for you.
Another thing to consider, depending on your needs, will be to add Customer Type on the Color Marks card and it will divide Customer Pay into 'Members' and 'Normal'.

Tricky getting average for price when summing extended and qty

The data we display is summarized by order type. Data looks: where ABCDE is the sum of one or more rows with same item #.
Item Order Type QTY PRICE EXT. PRICE
ABCDE INT 10 $100
I am not displaying price because this row is a summary of several in time frame selected. Price on these items changes in time or for customer.
So What I can do is give an average price.
I have 2 formulas but the result is not correct. all result is same number 91,979.00
formula 'new avg' sum({DATA_WHSV3.ITEM_PRC$}) / count({DATA_WHSV3.ITEM_PRC$})
then If {#new avg} > 0 then
sum({DATA_WHSV3.ITEM_PRC$})/{#new avg}
You can use a Running Total Field to do the average for you. So say your report is grouped by Item# you would create a new Running Total Field.
Running Total Name: RTotal0 (can be anything, this is just the default)
Field to Summarize: {DATA_WHSV3.ITEM_PRC$}
Type of Summary: average
Evaluate: For each record
Reset: On change of group: Group #1: DATA_WHSV3.ITEM_NUMBER
Then you can drop the {#RTotal0} into the group footer along with the other details for that item number and it should be the correct average.

Resources