I have to be missing something silly here. I can't find anything online or in the boards that fits my specific quirk.
I have a dashboard that show's a salesman's metrics for his territory. Since this report can be printed for them to hand off it needs to display their name. A sales manager doesn't have a territory assigned so he can see everyone's information.
What I'm trying to do is an if statement that determines if 1 salesman is selected (since each guy can only see their information) to show that name. If more than one is selected (like when the sales manager is looking at all territories) it shows his name.
My logic is...
If NumberOfSelectedSalesman > 1
Show Sales Manager,
This is my code. It counts all 5 salesmen no matter the filter selection, so it always shows the sales manager. Thoughts?
VAR SelectedSalesman =
VALUES ( Table[SalesmanName] )
VAR NumberOfSelectedSalesman =
CALCULATE ( COUNTROWS ( SelectedSalesman ) )
NumberOfSelectedSalesman // Used for troubleshooting, shows 5 salesmen selected
& IF (
NumberOfSelectedSalesman > 1,
Solved! Go to Solution.
Sure thing, sorry.
Try this code:
VAR selected = ALLSELECTED(Table1[Salesman])
VAR returnValue = IF(COUNTROWS(selected) > 1; "Sales Manager"; DISTINCT(Table1[Salesman]))
Thank you Ricardo, unfortunately it's doing the same behavior. It only shows the sales manager no matter what's selected. I had to change the semicolons in the IF to commas also (for anyone reading this).
Something I forgot to mention, the salesman field that does the filtering has many records in the table. Sales records with the owner (salesman) indicated, although there are only the 5 distinct salesman names.
Find out who's part of the program this season, and welcome the new Super Users.
We're excited to announce our first cross-community 'Can You Solve These?' challenge!
Learn about the exciting things that happened in July.
All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.
Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.