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.
I have a table called FAT_REGISTRY on PBI with many rows regarding my company's contracts. It has many duplicates for CONTRACT_ID and other fields due to columns like UPDATE_DATE and others.
I need to have a measure that calculates the average task duration for each task and on account of the table's structure I used AVERAGEX for that.
Completed Tasks Average Duration =
CALCULATE(
AVERAGEX(
SUMMARIZECOLUMNS(FAT_REGISTRY[TASK_ID], FAT_REGISTRY[TASK_DURATION]),
FAT_REGISTRY[TASK_DURATION]
),
FAT_REGISTRY[TASK_COMPLETION_DATE] <> BLANK(),
USERELATIONSHIP(DIM_CALENDARIO[Date],FAT_REGISTRY[TASK_COMPLETION_DATE])
)
However in the aforementioned measure it is not. When I plot it in a chart it shows me the result for the whole table instead of applying the date filter I select in the slicer. It is not affected by it at all.
I'm lost here. What should I change in the measure for it to work?
Solved! Go to Solution.
@juliamacg_
I woudl suggest you to try this pattern:
Completed Tasks Average Duration =
CALCULATE(
AVERAGEX(
VALUES(FAT_REGISTRY[TASK_ID]),
calculate(Sum(FAT_REGISTRY[TASK_DURATION]))
),
FAT_REGISTRY[TASK_COMPLETION_DATE] <> BLANK(),
USERELATIONSHIP(DIM_CALENDARIO[Date],FAT_REGISTRY[TASK_COMPLETION_DATE])
)
And regarding the issue with USERELATIONSHIP function, would it be possible for you share the sample file?
@juliamacg_
I woudl suggest you to try this pattern:
Completed Tasks Average Duration =
CALCULATE(
AVERAGEX(
VALUES(FAT_REGISTRY[TASK_ID]),
calculate(Sum(FAT_REGISTRY[TASK_DURATION]))
),
FAT_REGISTRY[TASK_COMPLETION_DATE] <> BLANK(),
USERELATIONSHIP(DIM_CALENDARIO[Date],FAT_REGISTRY[TASK_COMPLETION_DATE])
)
And regarding the issue with USERELATIONSHIP function, would it be possible for you share the sample file?
@tharunkumarRTK I tried your solution but the numbers turned out huge, so I changed the SUM part into AVERAGE and it worked!
Completed Tasks Average Duration =
CALCULATE(
AVERAGEX(
VALUES(FAT_REGISTRY[TASK_ID]),
CALCULATE(AVERAGE(FAT_REGISTRY[TASK_DURATION]))
),
FAT_REGISTRY[TASK_COMPLETION_DATE] <> BLANK(),
USERELATIONSHIP(DIM_CALENDARIO[Date],FAT_REGISTRY[TASK_COMPLETION_DATE])
)
Thanks so much!
User | Count |
---|---|
120 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
171 | |
117 | |
63 | |
57 | |
51 |