Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TomLU123
Helper III
Helper III

[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 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi , @TomLU123 

I don't know whether your error message is as follows.

Annotation 2020-01-16 175420.png

If yes ,maybe you can try to change your measures as below:

 

3.0 Site_not Start = CALCULATE(DISTINCTCOUNT('Table'[Location]),FILTER('Table','Table'[2.0_Site Dynamic Completion Category Tag]="Not Started"))

 

Here is a sample I made:

Annotation 2020-01-16 165534.png

 

URL: https://wicren-my.sharepoint.com/:u:/g/personal/michael_wicren_onmicrosoft_com/EeOEAye9aYRBpM9qoD5ZC...

 

If it doesn't meet your requirement, please let me know and show your expected result 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

1 REPLY 1
v-easonf-msft
Community Support
Community Support

Hi , @TomLU123 

I don't know whether your error message is as follows.

Annotation 2020-01-16 175420.png

If yes ,maybe you can try to change your measures as below:

 

3.0 Site_not Start = CALCULATE(DISTINCTCOUNT('Table'[Location]),FILTER('Table','Table'[2.0_Site Dynamic Completion Category Tag]="Not Started"))

 

Here is a sample I made:

Annotation 2020-01-16 165534.png

 

URL: https://wicren-my.sharepoint.com/:u:/g/personal/michael_wicren_onmicrosoft_com/EeOEAye9aYRBpM9qoD5ZC...

 

If it doesn't meet your requirement, please let me know and show your expected result 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.