Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I would like to optimise the calculation below. I guess if function or switch function would be helpfull.
Do you have any recommandation ?
MobileMedian3period=
Hello,
This code is more efficient and leaner:
1) creation of a measure
med_waiting = MEDIAN(waitingtable[nMb_days_waiting_total])
2) creation of this second measure
MobileMedian3period =
VAR MedM = CALCULATE(
AVERAGEX(
VALUES(table_year_period[no_periode(row)]),
[Med_waiting]
),
table_an_periode[no_periode(row)] <= 3
)
RETURN MedM
My waiting list don't have the same number of observations by period. To calculate a mobile median(mean of the 3 median), I need to calculate independently the median for these last 3 periods.
( I also perform the same for 13 period/a year).
It would be more effective if the calculation could go through all observation once or, until it is used like a else if .
Hi @Josee ,
If that wasn't the solution you were looking for, please provide a sample data and your expected result. Here's a guide on how the community can better answer your queries: https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523#M6071...
Proud to be a Super User!
Hi @Josee ,
You can actually add an or statement in filter so you can write your measuer this way:
MobileMedian3period =
DIVIDE (
CALCULATE (
MEDIAN ( waitingtable[nNb_days_waiting_total] ),
FILTER (
table_year_period,
table_year_period[no_periode(row)] >= 1
|| table_year_period[no_periode(row)] <= 3
)
),
3
)
Proud to be a Super User!
User | Count |
---|---|
117 | |
73 | |
58 | |
49 | |
48 |
User | Count |
---|---|
171 | |
122 | |
60 | |
59 | |
56 |