Forum Discussion

SeanB004's avatar
SeanB004
Frequent Visitor
2 years ago

A function selectedValue was used where a True/False expression was expected. This is not allowed er

Hi I have a dax formula thats supposed to calculate the percentage of the number of sales transactions based on a selected status. However when I enter in this dax formula: 

Percentage New_ =
VAR SelectedStartDate = MIN(CompanyOpportunities[opportunity_date])
VAR SelectedEndDate = MAX(CompanyOpportunities[opportunity_date])
VAR StatusOppts =
CALCULATE(
COUNTROWS(CompanyOpportunities),
CompanyOpportunities[status] = SELECTEDVALUE(CompanyOpportunities[status]),
CompanyOpportunities[opportunity_date] >= SelectedStartDate,
CompanyOpportunities[opportunity_date] <= SelectedEndDate
)
VAR TotalOppts =
CALCULATE(
COUNTROWS(CompanyOpportunities),
CompanyOpportunities[opportunity_date] >= SelectedStartDate,
CompanyOpportunities[opportunity_date] <= SelectedEndDate
)
RETURN
DIVIDE(StatusOppts, TotalOppts, 0)

I get the below error: