Forum Discussion
Weighted average within a certain date range
- Anonymous2 years ago
Hi PC2022 ,
You can create a measure as below to get it:
Weighted Average 6 Months = CALCULATE ( SUMX ( FILTER ( 'Test Full Pay Items', 'Test Full Pay Items'[Bid Date] >= DATE ( 2023, 5, 1 ) && 'Test Full Pay Items'[Bid Date] <= DATE ( 2023, 10, 1 ) ), 'Test Full Pay Items'[Highest Bid] * 'Test Full Pay Items'[Qty] ) / SUMX ( FILTER ( 'Test Full Pay Items', 'Test Full Pay Items'[Bid Date] >= DATE ( 2023, 5, 1 ) && 'Test Full Pay Items'[Bid Date] <= DATE ( 2023, 10, 1 ) ), 'Test Full Pay Items'[Qty] ) )If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your visual settings. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi PC2022 ,
You can create a measure as below to get it:
Weighted Average 6 Months =
CALCULATE (
SUMX (
FILTER (
'Test Full Pay Items',
'Test Full Pay Items'[Bid Date] >= DATE ( 2023, 5, 1 )
&& 'Test Full Pay Items'[Bid Date] <= DATE ( 2023, 10, 1 )
),
'Test Full Pay Items'[Highest Bid] * 'Test Full Pay Items'[Qty]
)
/ SUMX (
FILTER (
'Test Full Pay Items',
'Test Full Pay Items'[Bid Date] >= DATE ( 2023, 5, 1 )
&& 'Test Full Pay Items'[Bid Date] <= DATE ( 2023, 10, 1 )
),
'Test Full Pay Items'[Qty]
)
)
If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your visual settings. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards