Forum Discussion
A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expre
Getting the error when trying to calculate the percentage of distinct users [REGEID] with more than one device [ID]
Error: A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
Measure:
mcijerry Try using
DAX
PercentageOfUsersWithMoreThan2Endpoints =
VAR EmployeesWithMoreThan2Computers =
FILTER(
VALUES('EPD Endpoints'[RegEID]),
CALCULATE(
COUNT('EPD Endpoints'[ID]),
ALLEXCEPT('EPD Endpoints', 'EPD Endpoints'[RegEID])
) > 1
)VAR CountOfEmployeesWithMoreThan2Computers = COUNTROWS(EmployeesWithMoreThan2Computers)
VAR DistinctEmployeeCount = DISTINCTCOUNT('EPD Endpoints'[RegEID])RETURN
DIVIDE(CountOfEmployeesWithMoreThan2Computers, DistinctEmployeeCount, 0)
4 Replies
- bhanu_gautam
Super User
mcijerry Try using
DAX
PercentageOfUsersWithMoreThan2Endpoints =
VAR EmployeesWithMoreThan2Computers =
FILTER(
VALUES('EPD Endpoints'[RegEID]),
CALCULATE(
COUNT('EPD Endpoints'[ID]),
ALLEXCEPT('EPD Endpoints', 'EPD Endpoints'[RegEID])
) > 1
)VAR CountOfEmployeesWithMoreThan2Computers = COUNTROWS(EmployeesWithMoreThan2Computers)
VAR DistinctEmployeeCount = DISTINCTCOUNT('EPD Endpoints'[RegEID])RETURN
DIVIDE(CountOfEmployeesWithMoreThan2Computers, DistinctEmployeeCount, 0)- mcijerryNew Member
Interesting and almost there, the Measure at least passes inspection (and for the life of me I tried using FILTER everyewhere in the measure but did not know where to put it and to use it in place of CalculateTable)
Only issue now is I get 640.11 % 🙂
- mcijerryNew Member
I think I got it. One sec.
- mcijerryNew Member
Impressive Bhanu, thank you sir. Now, on to see how to get rid of "blank" coming back on my gauge when percentage is 0