Forum Discussion
weighted average date
- 5 years ago
This measure expression gets your expected result in a table visual with your Client column. Please check it with your real data. Replace "weighted" with your actual table name.
Weighted Date =
VAR mindate =
MIN ( Weighted[Payment date] )
VAR summary =
ADDCOLUMNS (
SUMMARIZE (
Weighted,
Weighted[Payment date],
Weighted[Amount]
),
"@days",
DATEDIFF (
mindate,
Weighted[Payment date],
DAY
)
)
VAR wavg =
ROUND (
SUMX (
summary,
Weighted[Amount] * [@days]
)
/ SUMX (
summary,
Weighted[Amount]
),
0
)
RETURN
mindate + wavg - 1Regards,
Pat
This measure expression gets your expected result in a table visual with your Client column. Please check it with your real data. Replace "weighted" with your actual table name.
Weighted Date =
VAR mindate =
MIN ( Weighted[Payment date] )
VAR summary =
ADDCOLUMNS (
SUMMARIZE (
Weighted,
Weighted[Payment date],
Weighted[Amount]
),
"@days",
DATEDIFF (
mindate,
Weighted[Payment date],
DAY
)
)
VAR wavg =
ROUND (
SUMX (
summary,
Weighted[Amount] * [@days]
)
/ SUMX (
summary,
Weighted[Amount]
),
0
)
RETURN
mindate + wavg - 1
Regards,
Pat