Forum Discussion
Anonymous
6 years agoNot applicable
Error in Text Function in Calculate in Power Bi Using DAX
I am trying to get average salary from Employee depending upon the # of rows returned.
_m =
IF (
CALCULATE ( AVERAGE( 'Employee'[Salary] ) = BLANK ()
),0, CALCULATE ( AVERAGE( 'Employee'[Salary] ))
)Now i want to do the same for Employee Name as well
_m =
IF (
CALCULATE ( Value( 'Employee'[Name] ) = BLANK ()
),"", CALCULATE ( Value( 'Employee'[Name] ))
)But here i am getting error Employee[Name] is not defined. Kindly guide me about this. Thanks
Hi Anonymous
I can reproduce your problem.
When I select Modeling->create column,
I can get "average per cate" and can make the "name" column convert to number type by the column or by changing the "Modeling"->"data type".
ave_per_cate = CALCULATE(AVERAGE('Table'[Salary]),FILTER('Table','Table'[cate]=EARLIER('Table'[cate]))) name_to = IF([Name]=BLANK(),BLANK(),VALUE([Name]))Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- v-juanli-msftCommunity Support
Hi Anonymous
I can reproduce your problem.
When I select Modeling->create column,
I can get "average per cate" and can make the "name" column convert to number type by the column or by changing the "Modeling"->"data type".
ave_per_cate = CALCULATE(AVERAGE('Table'[Salary]),FILTER('Table','Table'[cate]=EARLIER('Table'[cate]))) name_to = IF([Name]=BLANK(),BLANK(),VALUE([Name]))Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.