March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello everybody!
I have read some posts in the forum and I got my sum of averages working. But I noticed that when I am computing the sum of the averages, this computes also the zeros. My code is wrong but I cannot find out why.
My approach may not be the best, so any help will be very appreciated. I am calculating step duration as a calculated column, then a measure for its average, and the sum of the averages through a group_by.
I attach the file with measures and descriptions of the issue.
Thanks a lot for any suggestion
Solved! Go to Solution.
I solved with NOT and ISBLANK, in this way:
step duration avg measure = SUM(data[step duration]) / CALCULATE ( DISTINCTCOUNT ( data[# project], NOT( ISBLANK(data[step duration]].
And then reused my group by measure.
Thanks everybody for the hints! 🙂
I solved with NOT and ISBLANK, in this way:
step duration avg measure = SUM(data[step duration]) / CALCULATE ( DISTINCTCOUNT ( data[# project], NOT( ISBLANK(data[step duration]].
And then reused my group by measure.
Thanks everybody for the hints! 🙂
Hi @Hank_
You can take steps below for reference.
Create a measure:
TEST step duration avg =
CALCULATE (
SUM ( dati[step duration] ) / DISTINCTCOUNT ( dati[# project] ),
dati[step duration] <> 0
)
Then, you will get the following:
Hope it helps.
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hello @v-xiaotang , thank you. Exluding the empty steps was my first attempt.
This measures doesn't calculate the sum of the averages, like the measure 4 made with group by.
One way to make it work also for phase 4, which has an empty duration, is to add some condition on the measure 4, but for now I cannot find out.
Hi @Hank_
Still not clear about the result you want, can you mark the value you want on the picture like this?
Besides, you said "this computes also the zeros", so what do you want to exlude? Empty (which filtered by function Blank())? Or zero (which filtered by <>0)? Or both?
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
@Hank_
Not quite clear about the expected results but if you want to exclude the zero in your average measure or the Group By measure, you filter out the zeros as follows:
3_avg (OK for step 4; NO for step 1)) =
CALCULATE(
SUMX(
VALUES(dati[Step]),
AVERAGE(dati[step duration])
),
dati[step duration] <> 0
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @Fowmy ! Thanks for the hint! This measure calculates correctly the 110.5, but computes 18 instead of 11.1 which is the correct sum of averages for phase 1 😕
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
202 | |
137 | |
106 | |
70 | |
68 |