I have a line chart in PowerBi that shows the price of an index every hour. How can I show in the same chart the daily average of prices?
I have computed a measure which calculates it, but when i plot in the hourly chart the average is no longer daily but hourly.
Here is an example: for simplicity, let us say that days have 3 hours, what I want to compute in PowerBi is the last column:
day | hour | price | daily_average |
---|---|---|---|
1/1/2023 | 1 | 100 | 150 |
1/1/2023 | 2 | 150 | 150 |
1/1/2023 | 3 | 200 | 150 |
1/2/2023 | 1 | 50 | 60 |
1/2/2023 | 2 | 60 | 60 |
1/2/2023 | 3 | 70 | 60 |
I would like to plot a graph with both "price" and "daily_average".
What you need to do is to create a measure where you remove Hour from filtere context, ALL(Sample1[hour]):
DailyAVG = CALCULATE( AVERAGE(Sample1[price]), ALL(Sample1[hour]) )