How to show range of salary in Tableau bar charts - range

I have the following wage data in excel.
click here to view picture
In Tableau, I would like to display the Wage Range and the number of pax that fall into that range.
Do I created calculated field? How do I display it using bar charts?
Tableau novice here, so your help is much appreciated. Thanks.

Yes, you can use a calculated field, like so:
if [Salary] >= 6000 and [Salary] < 7000
then 'between 6000 and 6999'
elseif [Salary] >= 7000 and [Salary] < 8000
then 'between 7000 and 7999'
elseif [Salary] >= 8000 and [Salary] < 9000
then 'between 8000 and 8999'
else 'out of range'
end
Then in the Row shelf, put Job Title and Wage Range.
Put CNT(Number of Records) in the Text box of the Marks card.

Related

Calculate the percent difference between two percentages at two dates in Tableau

The goal is to create a column that shows the percent difference between to percentages.
Tried creating many calculated fields around
-first() - last() -- this just calculates the week number difference
-if date = #2019-02-03# then sum number of records else null end -- invalid
-case when date = #2019-02-03# then sum number of records else null end -- invalid
The 'filter 1' column is where I'd like to display this information.
Expected result:
row 1 in filter 1 should = 12% (absolute percentage change of -5 and 7)
Any help is super appreciated!
I figured this out in two ways:
one created two date fields - one for one week and one for the last week
: then made a diff % measure and used these as the columns.
There's another way, more gnarly:
if first() == 0 then
(
window_sum((if last() == 0 then sum(count_measure) end))
-(window_sum(if first()==0 then sum(count_measure) end))
)
/(window_sum(if first()==0 then sum(count_measure) end))
end

Grouping similarly to MySQLs GROUP BY

I have a dataset which looks somewhat like this;
email minutes date
aaa#aaa.com 40 10-01-18
aaa#aaa.com 60 10-01-18
bbb#bbb.com 10 10-01-18
bbb#bbb.com 40 10-02-18
ccc#ccc.com 60 10-02-18
I wish to group by email and filter for total minutes per date > 80. So on 10-01-18 aaa#aaa.com has >80 but bbb#bbb.com has not.
How can this kind of filtering be achieved?
Create a calculated field :
{FIXED [email], [date] : SUM([minutes])}
Place it on the filters shelf >> All values >> 80 trashhold >> Ok
Now right click new filter pill and select option Add to context (so filter'll be applied before other calculations)

Using a single Calculated field , can I get the number of weekdays calculated from the current month in Tableau?

I have a requirement to do % of (Workdays till date) / (Total Workdays of the month). How can I create a "Calculated field" for this logic. I don't need to consider holidays or any sort. Any help is highly appreciated.
A quick google search turned up this:
http://kb.tableau.com/articles/knowledgebase/calculating-the-number-of-business-days
In the Calculated Field dialog box, do the following and then click
OK: Name the calculated field. In the example workbook, the calculated
field is named Number of Weekdays. In the formula field, create a
calculated field similar to the following:
DATEDIFF("weekday", [Start Date], [End Date])
- 2 * (DATEPART('week', [End Date]) -DATEPART('week', [Start Date]))
+ (IF DATENAME('weekday',[End Date]) = 'Saturday' OR DATENAME('weekday',[Start Date]) = 'Sunday'
THEN 0 ELSE 1 END)
In your example you take the difference between the first and the last of a month and calculate the working days by subtracting 2 * [number of weeks] for the weekends. Once you have that value you can easily create the ratio you wanted.

Tableau: Aggregate and Non-aggregate error with Date calculations

I'm having trouble with a calculation in tableau. I've created some calculations that are listed at the top that I use in the calculation I'm currently working on.
Last 30 days calc:
IF [Date] < (today() - 31) OR [Date] > today()
THEN NULL ELSE [Date] END
Price-AvgWeighted calc:
SUM ([SaleTotal]) / SUM([Qty])
Calculation with ERROR:
IF NOT (ISNULL([Last30days])) AND [Rev]>500 AND QTY > 10 AND [Price] < (.7*([Price-AvgWeighted]))
THEN 'True'
ELSE 'False'
END
ERROR: cannot mix aggregate and non-aggregate arguments with this function. (Highlights the "<")
My goal is to create a calculation that does the following:
"If in the last 30 days revenue is greater than 500 and qty is greater than 10 for all previous sold and the current (available) price is less than .7 of the last 30 day weighted average sales price THEN True/false"
I'm also not sure how to incorporate the Status Dimension (shows type of product: sold/avil)
Any help would be greatly appreciated. Thanks
It looks like you have to turn [Last30days], [Rev], [QTY] and [Price] into aggregations since [Price-AvgWeighted] is an aggregation.
Try the following:
IF NOT (ISNULL(ATTR([Last30days]))) AND SUM([Rev])>500 AND SUM([QTY]) > 10 AND SUM([Price]) < (.7*([Price-AvgWeighted])) THEN 'True' ELSE 'False' END

Crystal Report Date Range Report

i'm using Crystal Reports and I have an output like this (group by day):
(This output calculation is from 00:00 to 23:59 each day..)
Date (dd/mm/yyyy) Weight
-----------------------------------------
01-01-2013 4000
02-01-2013 3000
03-01-2013 6000
04-01-2013 5000
How can I make it by time range like 01-01-2013 6:00AM to 04-01-2013 6:00AM and the output still as per day:
(I pretend the half of current day + half of the next day)
Date (dd/mm/yyyy) Weight
-----------------------------------------
01-01-2013 3500 ( =half of 01-01-2013 and 02-01-2013)
02-01-2013 4500 ( =half of 02-01-2013 and 03-01-2013)
03-01-2013 5500 ( =half of 03-01-2013 and 04-01-2013)
04-01-2013 2500 ( =half of 04-01-2013 and so on..)
Thanks,
You'd want to check the time whether it's before or after 12:00 noon. If it's 11:59:59 or less, add it to the previous day. Anything after, current day. Create a formula using something like this
IF TIME({yourdatetime}) <= TIME(11,59,59) THEN
DATE({yourdatetime}) - 1
ELSE
DATE({yourdatetime})
Then group by the formula and format the group header for just the date.