I have, in PowerBI (October 2017 release) some data showing the snapshotted output of some solar panels at five-minute intervals.
I presently have a measure which calculates the total production for each day by getting a sum of the instantaneous readings for the day and dividing by 12 (because there are 12 readings per hour) and then shows the average of this daily amount over whichever period is in the current context:
Avg Daily Production (KWh) =
AVERAGEX(SUMMARIZE('Solar Output', 'Solar Output'[Date], "Daily Production (KWh)", SUM('Solar Output'[Production (KW)]/12), [Daily Production (KWh)])
For my visualisations I'd like to show a chart which displays the average production at various times of the day compared to the production at that time for the best day, i.e. the day with the highest value for [Avg Daily Production (KWh)]
.
Here is my working so far:
Identify the top day by using
Best Day = TOPN(1, SUMMARIZE('Solar Output', 'Solar Output'[Date], "Daily Production (KWh)", [Avg Daily Production (KWh)]), [Daily Production (KWh)], DESC)
But this produces a row, not a scalar, and I can't quite work out how to just get this date and use it as a filter for a measure like this:
Production On Best Day (KW) =
CALCULATE(SUM([Production (KW)]), FILTER(ALL('Solar Output'[Date]), 'Solar Output'[Date] = [Best Day]))
The chart I want would look like this, with the average production for the selected dates in green and then another series showing the production at those times on the best day pencilled in red.
FIRSTNONBLANK(ColumnName, Expression)
requires a column reference as an argument butTOPN()
returns a table... – mendosi