Tableau - filtrer with condition - database

I have departure and arrival station data and the number of searches associated with that station for a journey.
I would like to have a histogram with the top 5 of the most searched arrival stations (1st column) taking into account the 5 most searched departure stations(2nd column). I can't find a way to filter the arrival stations.
Can you help please ?

Related

How to find number of weekdays excluding saturday and sunday between two dates in quicksight?

I am trying to build a dashboard displaying employee attendance using punch in and out data.
One of the field in my dashboard shows average days employee was present between a time period. The formula i want is like below
Average attendance = number of punch in / number of working days between (start date, end date)
Can someone please help me how to find the number of working days between these two dates?

Is there a way to consolidate multiple formulas into one

all:
I am trying to design a shared worksheet that measures salespeople performance over a period of time. In addition to calculating # of units, sales price, and profit, I am trying to calculate how many new account were sold in the month (ideally, I'd like to be able to change the timeframe so I can calculate larger time periods like quarter, year etc').
In essence, I want to find out if a customer was sold to in the 12 months before the present month, and if not, that I will see the customer number and the salesperson who sold them.
So far, I was able to calculate that by adding three columns that each calculate a part of the process (see screenshot below):
Column H (SoldLastYear) - Shows customers that were sold in the year before this current month: =IF(AND(B2>=(TODAY()-365),B2<(TODAY()-DAY(TODAY())+1)),D2,"")
Column I (SoldNow) - Shows the customers that were sold this month, and if they are NOT found in column H, show "New Cust": =IFNA(IF(B2>TODAY()-DAY(TODAY()),VLOOKUP(D2,H:H,1,FALSE),""),"New Cust")
Column J (NewCust) - If Column I shows "New Cust", show me the customer number: =IF(I2="New Cust",D2,"")
Column K (SalesName) - if Column I shows "New Cust", show me the salesperson name: =IF(I2="New Cust",C2,"")
Does anyone have an idea how I can make this more efficient? Could an array formula work here or will it be stuck in a loop since its referring to other lines in the same column?
Any help would be appreciated!!
EDIT: Here is what Im trying to achieve:
Instead of:
having Column H showing me what was sold in the 12 months before the 1st day of the current month (for today's date: 8/1/19-7/31/20);
Having Column I showing me what was sold in August 2020; and
Column I searching column H to see if that customer was sold in the timeframe specified in Column H
I want to have one column that does all three: One column that flags all sales made for the last 12 months from the beginning of the current month (so, 8/1/19 to 8/27/20), then compares sales made in current month (august) with the sales made before it, and lets me know the first time a customer shows up in current month IF it doesn't appear in the 12 months prior --> finds the new customers after a dormant period of 12 months.
Im really just trying to find a way to make the formula better and less-resource consuming. With a large dataset, the three columns (copied a few times for different timeframes) really slow down Excel...
Here is an example of the end result:
Example of final product

Calculating sales per hour

I am trying to calculate inventory sales based on missing inventory broken up into hours per day. (Each hour has a sequence number that references the time stamp...ie sequence#1 = 0:00-1:00). I need to get the average sales per hour over the course of a 3 month period. On top of that I also need to throw out upreadings in inventory.
Here is a snippet of my data:
UPDATE:
My plan is to take the current Inventory level(InvValue) and subtract it agains the previous inventory level(InvValue) for that hour. My problem is I don't know how to format the loop in order to organize the data to the right Hour(inv_sequence)
My end goal is to have:
hour 1 average : hour 2 average : hour 3 average
etc.
"average sales per hour" = count of total sales / (days * 24)
You are either overcomplicating things, or your specification of the task is not accurate,,,
All you need is the Average of Inventory per Hour?

Calculation of Night shift hours

I am stuck with an issue, I have to create an attendance system where I have an employee id and punching time.
There can be multiple punches in a day. So firstly for night shift employees I can't determine his actual in and out time and thus not the duration too.
For example a person came office at 11 pm on 1st April and left at 4 am on 2nd April. In between he also went out for dinner or tea .
I don't have a fixed number of punches. And I need to handle 2 dates as well. So min and max logic wont work.
The major problem is there are multiple punch-ins and row_number wont work as punches are of 2 different dates in case of night shift.
here tktno is employeeID , date is the punching time and sno, is number of punches in a day. I have sent you a sample data of a night shift employee.
I require data in given below format -
But here as you can see the hours calculation is not correct . I want to correct it .

Calculate number of full time equivalent employees using DAX measures

I am able to calculate how many employees are working using DAX measures:
Number of employees started := CALCULATE(COUNTA([Emp from]);FILTER(ALL(tDate[Date]);tDate[Date]<=MAX(tDate[Date]))) -
Number of employees quit := CALCULATE(COUNTA([Emp unitl]);FILTER(ALL(tDate[Date]);tDate[Date]<=MAX(tDate[Date])))
Number of employees working := [Number of employees started] - [Number of employees quit]
But I have not managed to calculate how many full time equivalent employees are working. Each employ has a workload from 0% to 100%.
How can I calculate the number of full time equivalent employees?
I have tried the following for number of full time equivalent employees started, but in contrast to the measures above it doesn't accumulate over time. It just shows the results for each individual month:
Number of full time equivalent employees started:=CALCULATE(SUMX(tEmployees;tEmployees[Workload]*Not(ISBLANK(tEmployees[Emp from])));FILTER(ALL(tDate[Date]);tDate[Date]<=MAX(tDate[date])))
Do you have any suggestion for how I can solve this?
You might try something like this. In your Emp table have the start date and end date for the employee. In your measure you would use the calculatetable function to create an in memory table that has one row for each date in your date table and each employee id. This same in memory table would take the work percentage and create a column that that represents the number of hours worked by that employee on that day. Then you just need to express number of 'equivalent' employees as: sum of number of hours worked/(number of hours in a 'full time work day' * count of days in period). This should give you a measure you can use along with your dates to find the number of full time equivalent employees in on any given day or over any given period.
See my sample table structure in this TechNet forum post. This is a modelling problem first, and a DAX problem second.
Once you've created your headcount fact, all of this becomes trivial.

Resources