Forum Discussion

TomLU123's avatar
TomLU123
Icon for Helper III rankHelper III
6 years ago
Solved

[Seek Help] How to create a measure base on a condition defined another measure?

Dear experts, 

 

I am creating a survey completion tracking report.  The raw data is like below which has one employee per row. 

Empoloyee IDLocationBusiness DivisionVPStatus
123123USAAJimDone
223223USABAndyNot Done
333333HKAAndyNot Done
443443ChinaALukaNot Done
553553ChinaCMandyNot Done
221221SingaporeCMandyDone

 

I have created following measures to calculate the completion rate:

  • 1.0 CF_Total Participants = DISTINCTCOUNT(Table[Employee ID])
  • 1.1 CF_Number of Completed = CALCULATE(DISTINCTCOUNT(Table[Employee ID]),Table[Status]="Done")
  • 1.2 CF_Completion Rate = ([1.1 CF_Number of Completed]/[1.0 CF_Total Participants])+0

The needs are to be able to categorize the location based on the completion rate into "Not started", "1-50%, "51-99%", "Completed" . I have created following dynamic measure to calculate the completion rate category which works fine. Dynamic means the return value will change based on the locaion and VP selected in the filter. (e.g. For all, USA's completion rate is 50%. But if we filter to VP Jim, the USA's copletion rate is 100%)

2.0_Site Dynamic Completion Category Tag = SWITCH(True(),

[1.2 CF_Completion Rate]=0,"Not Started",
[1.2 CF_Completion Rate]>0&&[1.2 CF_Completion Rate]<=0.5,"1-50%",

[1.2 CF_Completion Rate]>0.5&&[1.2 CF_Completion Rate]<1,"51-99%",

[1.2 CF_Completion Rate]=1,"Completed")

 

Now is the problem: I want to create antoehr dynamic measure to count the location by the dynamic rate category.

3.0 Site_not Start = CALCULATE(DISTINCTCOUNT(Table[Location]),[2.0 CF_Avg Completion Duration]="Not Started")

 

But the error says its filter function can only use as table filter. Is there any way that I can create the 3.0 Site Not Start by counting the number of locations whose 2.0 Site Dynamic Completion Category Tag is "Not Started"?

 

Many thanks!

1 Reply