Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi there,
I have a calculated measure called cancellation rate. However, I want to find the median value among the group, but do not consider those who do not have a cancellation rate. How to revise the below measure?
Group Assessment cancellation rate = MedianX(filter(f_calls,[Assessment cancellation rate]>=0),ALLSELECTED(d_users),[Assessment cancellation rate])
Hi, please try this revised measure. Thanks!
Group Assessment cancellation rate = MedianX( FILTER( f_calls, NOT(ISBLANK([Assessment cancellation rate])) && [Assessment cancellation rate] >= 0 ), ALLSELECTED(d_users), [Assessment cancellation rate] )
@Anonymous Thank you for your reply. It shows like: Two many arguement were passed to MedianX, the man is 2. Do you have any guidance on how to revise this?
Inaddition to that, the filter is store under user table, group column and name column.
The relationship is users.id = calls.assigned_user_id
MEDIANX is inherently slow as it needs to be done by the formula engine. However, you can improve your expression. What is the expression for your cancellation rate measure? Do you have more than one table in your model? Are you trying to get the median of all calls/rows? Or get the median of the rate for the values in another column or table (dimension)?
Pat
@ppm1 Another comment is for the median, the number need to filter our the null or blank value.. but include cancellation rate which is 0.. Thank you!
Here is a better (more performant way to write one of your measure (do the same for the other). It is not good practice to FILTER a whole table in a CALCULATE (especially a big fact table).
Count_Assessment_Cancel/Missing =
CALCULATE (
COUNT ( f_calls[Parent_id] ) + 0,
f_calls[Status] IN { "Cancelled", "Missing", "Cancelled_24hr" },
f_calls[Type_c] IN { "Assessment", "Screening" }
)
For the MEDIANX calculation, are you intending to evaluate your measure on every row of your calls table? If so, that is another bad practice to trigger context transition on every row of a large table. Hopefully you want to evaluate your measure for each value of a dimension column and take the MEDIAN of that. Please clarify. Sample data with expected output would be helpful.
Pat
Hi @ppm1 ,
Thanks for the reply. So in the call table, each row represent one phone call record. And each records as an id (who did this call) to link to the user table.
The call table include the call time, call status(held or not held or cancell etc) and call type.
I would like to know, for a given perid, what is the group cancellation rate?(One is the rate will not influence by which user table filter I chose) The second one is it will influence by the user group I choose, but not the individual users. Thank you!
Did you already rewrite the base measure as suggested? If so, how much did it speed things up. In any case, if I understand you correctly, the one that will respond to slicers would be
MEDIANX(VALUES(UserTable[UserColumn]), [Assessment cancellation rate])
And the one that would ignore slicers would be
MEDIANX(ALL(UserTable[UserColumn]), [Assessment cancellation rate])
Pat
@ppm1 Thanks for the reply. I will try the speed up measure. Can you help me with the below follow up question?
f I understand you correctly, the one that will respond to slicers would be
MEDIANX(VALUES(UserTable[UserColumn]), [Assessment cancellation rate])
Re: This is not correct, since some user show as NaN, some user show as 0, some user show as 1, I would like the value to calcuate based on the use[group], but not change on individual user user[name] filter
And the one that would ignore slicers would be
MEDIANX(ALL(UserTable[UserColumn]), [Assessment cancellation rate])
Re: This is not correct, since all the value is showing NaN no matter which user I choose
Hi Pat, Please see my response below: @ppm1
And I have two employee filters on the dashboard(one group, one employee name), I would like to find the median cancellation rate among the group:
1. I just want to find the median value across the entire group regardless of which group and people I selected
2.I want to find the median group value, for example, if I click group a, then the value will show group a median cancellation regardless of which people I selected
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
96 | |
90 | |
79 | |
67 |
User | Count |
---|---|
150 | |
118 | |
111 | |
106 | |
95 |