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.
Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.
Join this community-driven Power Platform digital event for unbiased support and problem-solving.
Visit our Community Blog for articles, guides, and information created by fellow community members.