How do you calculate percent change in tableau when the original fields are calculated with fixed LOD? - tableau-api

I am currently working in tableau and could not find the answer to this question on the tableau forums or on stack overflow. To get the yearly ticket sales in the attached screenshot, I had to used a Fixed LOD calculation to get the 2018 and 2019 tickets sold to be accurate. For some reason a COUNT formula would not provide the correct number of tickets sold, so I cannot use the below, which is what I previously used.
COUNT(IIF(CONTAINS([Event Year],"2018"),[Ticket ID],0))
I am now using the below for both 2018 and 2019 separately, which gives me the correct ticketing data when cross referencing with the data in excel:
{ FIXED [Ticket Id] : SUM(
IF [Event Year] = "2018"
THEN 1
ELSE 0
END)}
However, since I had to used this Fixed LOD calculation, the percent change from 2018 to 2019 is not correct (see screenshot).
Does anyone know how to calculate the % change for fields that used Fixed LOD?
When I go to create a table calculation to get percent change, there is not an option for row percent difference, and I am assuming this has something to do with the LOD in place.
Thanks in advance for any help you are able to provide!

Related

How is it possible to calculate value for the same day last week in tableau for every day?

I would like to calculate values for yesterday for every date in a table.
Firstly I have simply calculated the number of orders for each date using COUNTD function.
But afterwards I encountered some problems trying to calculate values for "yesterdays".
Please refer to the image
example
For example for 12th of April I would like to obtain the value for 11th of April.
On the internet there are a lot of examples using today() or max() or table functions but they do not give the required result because a would like to filter for example 12th April but still see the value for 11 April.
Could you please help, how is it possible to do this?

Tableau Summing up aggregated data with FIXED

Data granularity is per customer, per invoice date, per product type.
Generally the idea is simple:
We have a moving average calculation of the volume per week. MA based on last 12 weeks (MA Volume):
window_sum(sum([Volume]),-11,0)/window_count(count([Volume]), -11,0)
We need to see the deviation of the current week vs the MA for that week (Vol DIFF):
SUM([Volume])-[MA Calc]
We need to sum up the deviations for a fixed period of time (Year/Month)
Basically this should show us whether on average, for a given period of time, we deviate positively or negatively vs the base.
enter image description here
Unfortunately I get errors like:
"Argument to SUM (an aggregate function) is already an aggregation, and cannot be further aggregated."
Or
"Level of detail expressions cannot contain table calculations or the ATTR function"
Any ideas how I can go around this one?
Managed to solve this one. Needed to add months to the view and then just WINDOW_SUM(Vol_DIFF).
Simple as that!

Tableau - What would the LOD calculation be?

Pretty new to Stack overflow but hoping to get an answer to one of my project work
Region Sales Sales (LOD calculation only)
West 100 0
East 50 -50
North 200 100
What would the LOD calculation be to get 0,-50 and 100 in column Sales (LOD calculation only)?
I do understand that row 2 and row 3 are both subtracted from first row. It's easy to do with Table calculation but i am unable to figure the LOD part out
Welcome to Stack Overflow, i am also very new so hope i am helpful.
Looking at your requirement, i believe a LOD expression would not be valid for this. As you have mentioned you are already able to get your results using table calculations, which is the right approach for this type of problem.
LOD expressions are used when you need to do some aggregation in your data which is at a different grain then the selected dimensions.
Hope this helps.
To get sales like the one you displayed, to embed an if statement in an LOD calculation and subtract the initial sales from that number. You could write it as one big calc, but I'll break it down for simplicity.
You'll need a way to assign the amount for the western region to every row.
That calculation is
{EXCLUDE[Region]:SUM(IF [Region]='West' THEN [Amount] END)}
Then you subtract the initial sales with a field like this
SUM([Sales])-SUM({EXCLUDE[Region]:SUM(IF [Region]='West' THEN [Amount] END)})

How to change the range values in Qliksens

I am practicing on how to use Qliksense and I came across this problem. I want to change the range values for the y-axis to show the difference in the Number of Sales between Year 2016 and Year 2017, which have values 105004 and 105609 respectively. However, as the values are too close to each other, I have been trying to find out how to change the values for the y-axis so that the graph will be able to show the difference in the Number of Sales between Year 2016 and Year 2017 more clearly. The picture below shows the graph of the no. of sales between Year 2016 and Year 2017. Please kindly advice on how to change the range values.
You can change the Min value to reduce the range
The max value you can increase a bit for better formatting.
This will give you a better perception of the variation
changing the min and max
barplot

Aggregating data from the US stock market in Tableau, using different time frames

I am a very basic user of tableau and I have not found an answer to my question.
I have a txt file that has historical daily data for 98% of all the stocks in the US, with their daily capitalization. Each stocks has its TICKER, Daily Market Value for every trading day of the year, and its SECTOR.
I did a simple time series that display SUM([Mktval]) (sum of all individual market values) across all stocks, on a daily daily, and where I can see that the total value as of 2016 is about 24 Trillion USD, as in the image below.
When I change the view column from DAY to YEAR, I don't see the right values, but something a lot larger. So I realized that I need to do SUM([Mktval])/252 to get the right value for a year (there are 252 trading days in a year).
If I change the view to MONTH, as in the chart below, the numbers are again wrong because 252 is not the right value to use in the division.
Is there any way that Tableau can adjust the values automatically to reflect the AVG MktVal across different time intervals?
Thanks
Replace SUM(Mktval) on the Rows shelf with the following calculated field
avg({ fixed day(Date1) : sum(Mktval) })
That solution is all in one step. It is perhaps a bit more clear to use 2 steps. First, create a calculated field called total_daily_market_value defined as
{ fixed day(Date1) : sum(Mktval) }
Then make sure that calculated field is a measure. It is an LOD calculation that you can think of as a separate table with one value for each day showing the total market value for that day.
Drag that measure to a shelf, and then change the aggregation function to AVG(), MEDIAN(), MIN(), MAX() or STDEV() as desired. Tableau will aggregate the total_daily_market_value using your chosen aggregation function for whatever values of Date1 are in your view.