Forum Discussion
Fistachpl
Helper III
1 year agoNOT INVALUES is not working
I have two tables: SalesReps with Columns Name, Phone Jan Kowalski, 48123456789 and PhoneLogs with Columns Caller, RecipientNo, CallLength and some other columns I have relation between bo...
- 1 year ago
Hi Fistachpl ,
Thank you for reaching out to Microsoft Fabric Community Forum.
here can calculate how many times each Sales Rep called another Sales Rep based on phone number here i have used TREATAS & LOOKUPVALUE function.
CallsToSalesReps :=
CALCULATE(
COUNTROWS(PhoneCalls),
TREATAS(VALUES(SalesRep[Phone]), PhoneCalls[RecipientNumber])
)2)
SalesRepName =
LOOKUPVALUE(
SalesRep[Name],
SalesRep[Phone], PhoneCalls[RecipientNumber]
)Regards,
Chaithanya.
Fistachpl
Helper III
1 year agoHello,
no problem take a look here:
Phone calls of Sales Reps.pbix
Please note that it calculates the total sum correctly, but sums for each sales rep are incorrect.
johnt75
Super User
1 year agoYou need to use removefilters when calculating the reps numbers
_callLength =
VAR SalesRepNumbers = CALCULATETABLE(
VALUES ( SalesReps[Phone] ),
REMOVEFILTERS()
)
VAR Result =
CALCULATE (
SUMX ( PhoneLogs, PhoneLogs[Length] ),
NOT PhoneLogs[Recipient] IN SalesRepNumbers
)
RETURN
Result