Tableau Username() function to filter Revenue data by SalesRep - tableau-api

How do I filter the Sales Revenue by SalesRep so that each SalesRep should be able to see only the sales volume generated by them using the username() function.
Let's assume John generated $2000 revenue, Jena generated $3000 and Eric generated $5000. Total sales volume combined for all 3 SalesRep is $10000. Employee ID of John is 101, Eric is 102, Jena is 103. I'm the manager and my employee ID is 104. I want to use the username() function in Tableau to filter the data in a such a way that John should see only revenue generated by him i.e. $2000 and he should be able to see the revenue generated by Jena in the bar chart. Similarly, Eric and Jena should be able to check their respective sales revenue. However, I should have the access to the revenue of all 3 as I'm their manager. How do I implement it in Tableau using the USERNAME() function.

One possible solution could be with the help of ISUSERNAME():
Let's say SalesRep is an existing dimension in the datasource which has sales representative's full name or username or empid (Note: In below illustration I am considering that it has username e.g. John, Eric etc. For other options refer here).
Create a calculated field SalesUsersList as below (here list down ALL
members entry):
IF ISUSERNAME("John_Tableu_Username") THEN "John"
ELSEIF ISUSERNAME("Eric_Tableu_Username") THEN "Eric"
ELSEIF ISUSERNAME("Jena_Tableu_Username") THEN "Jena"
ELSEIF ISUSERNAME("Manager_Tableu_Username") THEN "Manager_Username"
END
Create a calculated field LimitedAccessUsers as below (here list
down ALL sales team's members entry who will have limited access):
([SalesUsersList]="John") or ([SalesUsersList]="Eric") or ([SalesUsersList]="Jena")
Create a calculated field hasLimitedAccess as below. Drag it to
'Filters' section and select True
NOT[LimitedAccessUsers] OR ([SalesUsersList]=[SalesRep])
Don't forget to let us know in case it solved your problem :)

Related

Data studio calculated fields

I have the following dataset:
Week #
Company Name
Product
# of transactions
Week1
Company A
Product 1
100
Week1
Company B
Product 1
30
Week1
Company A
Product 2
100
Week2
Company B
Product 2
50
My goal is:
for each COMPANY (there could be multiple rows per company) calculate Usage score with the following formula total # of transactions per company/100. For example, from the table above Company A has 200 transactions and Usage score=2 - I've done it successfully
categorize each company per the following formula: when usage score>1 then "promoter" else "critic" - I've done it successfully
Count promoters and critics - that's where I fail. Data studio in this case calculates Usage score and NPS per row, not per company. Therefore, I have promoters per product, not per company.
please help, I'd appreciate
You can solve this by Re-aggregating the Datasource with itself where the Second Join is the Datasource itself with the Key Company Name and the Metric Usage score make sure to set its Aggregation to Average.
Now you have a new Datasource with each Company and Row having its Usage Score in one column.
Unfortunately I don't understand the NPM part.
Hope this help though

How to Display the Sales and Other Department Sales Seperatly on Tally

hope you all are good .I new to tally and I have a new situation ,I have provided the details below
1.we Own a supermarket and which contains some other departments as well
2.only one counter is available for this supermarket section
3.so the sales of other departments also get mixed with the total sale
Task :- when I enter this data into tally I have to show the other departments sales seperatly on balance sheet, how to achieve this
The Profit & Loss statement in Tally shows you the sales data of every Sales ledger separately. So, to have data on separate sales for separate departments, you will have to make different sales ledgers for different departments and make the entries accordingly.
If you are using combined single ledger for all sales, then you should make three ledgers now for sales of each of the three departments. If you are using sales ledger item wise or tax slab wise, then you need to create similar ledgers for every department and take care of choosing the right ledger when creating the voucher.

Tableau - Most recent record by multiple criteria

I am working on a dashboard in tableau and need to pull the most recent record for each CustomerID ONLY IF the shipment type is 1, 2, or 3 (exclude 4) AND the customer is set to a type of a, c, d (exclude b).
Here's a sample of the data structure:
data structure
Here is what the answer should be:
Answer
New to tableau desktop and have been playing around for way too long - any help would be greatly appreciated!
Here is an example using LOD calculations and filters Example workbook
You can download the workbook to see the calculations and filters.
It assumes each shipment row has a unique Shipment Id that increases with date, so that it can be used to determine which shipment is the latest per customer.
See the filters and calculated fields that support them. The solution uses a context filter to make one filter apply prior to the others, and an LOD calculation to find the id of the latest shipment for each customer.
{ FIXED [Customer] : max([Shipment ID]) }

How to link tables as one-many in crystal report

I am using
OS - Windows 7,
technology - progess 4gl.
I have two tables customer and order. I am displaying customer details along with their orders. Each customer may have more then one order. The report should be as below
CUSTOMER:-
CUMTOMER NAME ADDRESS
CUSTOMER1 XYZ
ORDER1 OF CUSTOMER1:-
ORDER NO. ORDER DETAILS
1 ASD
2 ASDFGGH
3 FGHJFG /* IT SHOULD REPEAT FOR THE PARTICULAR CUTOMER */
CUSTOMER2 ABC
ORDER1 OF CUSTOMER1:-
ORDER NO. ORDER DETAILS
1 ZXC
2 VNVN
3 JJLK
I Think for this we need one-many relationship between customer and order table. I have only customer and order temp-tables for doing this.Can you please tell me How to repeat the loop inside customer and how to link the tables in one-many relationship. Thanks in advance.
you should write a stored procedure and then link that SP with your report.
I don't know why you would need anything more complicated than a join.
Something like:
select * from customer, order where order.custNum = customer.custNum.
Having said that -- you might find this Progress Knowledgebase article relevant. Some versions of Crystal apparently produce SQL that might need to be adjusted:
http://knowledgebase.progress.com/articles/Article/18979
It sounds like you are just having an issue with how it is shown, I would join the table like Tom suggested order.custNum = customer.custNum
but in the Design section I would do the following:
GH1a Customer Name
GH1b Customer Information
GH2 Order Number
Det Order Information
you could also place all of the Customer Information (name, addr, etc) into a formula so that if the customer doesn't have all the data filled in it won't be shown, and won't show a blank line.

How To EXPRESSION with WHERE " count Orders WHERE customer = Mr. Smith "?

I am a beginner in iReport and I cant program Java so I hope you can give me an idea.
I've already managed to make a chart that displays how often all customers have ordered in february, march,... etc.
Thats how I did it:
In category expression I have: $F{Month}
In value expression I have : $F{count(Orders)}
But I want to display how often only one customer (for example customer a) has ordered in february, march,... etc.
I have the following values which i can use:
Month, Orders and Customers(here are all customer names saved)
-------//-----------UPDATE--------------//-----------------------------------
I want to display a chart which represents the total orders per month of a customer. But iam trying to display my 3 customers (my database has only 3) in only one chart (stacked).
For example(see picture above): I want to display the total orders from Customer A (yellow) in february. And I want to display the total orders from Customer B (blue) in february and the same for customer C.
The customers should be displayed stacked (3 in every month) and every customer should have a different color plus the total orders from every customer should be displayed ...like in picture above for example:
customer A(yellow) made 3 total orders in february, Customer B(blue) made 2 total orders in february, customer C..etc.
it is very important that every month displays 3 customers...stacked.
How do I do this?
I appreciate every idea.
From what I have understood from your question, you want to show a chart which represents the total orders per month of a customer.
You need not use stacked bar graph for this purpose.
You may want to use bar graph which would serve your purpose.
If you want to see the chart per customer, create one parameter $P{customer} and pass it into your query.
Refer document iReport-Ultimate-Guide-3 on how to create parameters and to use it in queries.
e.g:
select customer,month,count(orders)
from <your table>
where customer=$P{customer}
group by month
The above approach would work if you want to see the details for only one customer.
**Here is my solution after your update.**
From your update, it seems like you want to represent the total orders per month for all the customers.And you want to use stacked chart for the same.
Then what you have done is correct but have missed to add a field to your 'Series Expression'
Add your field customer to your series expression and this will resolve your problem i.e,
Series Expression : $F{customer}
Category expression : $F{Month}
Value expression : $F{count(Orders)}
This will display the chart in the format you have specified.
Create a paramter that takes your customer name $P{customerName}
and another takes month $P{month}
pass these two paramters to your sql like that
SELECT customer_name, order_count FROM customers
bla.. bla..
WHERE customer_name=$P{customerName} and month=$P{month}
then create a chart with only one serie to show one customer as one color. Not like yours with 3 colors.
Fell free to ask for more specific detail.