2 years ago

#75827

test-img

Italo Brenner

Power BI - Compare daily average to last month's weekday average

I want to make the following graph, compare the average of the value of the day with the average of the day of the week of the last month. A column chart with the average of the last seven days, in the same one a line chart with the average of that day of the week in the last month. For example, today 01/20/2022 is a Thursday, so today's chart will show a column with today's average and a line pointing to the average of all Thursdays in December. The same goes for the last seven days. I've already tried to make a calculate table with the day of the week and the average of the last month for each of them, but it doesn't answer my problem because I need it to enter within the filter context, to allow the selection by customer or its region.

Table

Date | Customer | Value


Some things I've tried

Measure with to find the last month:

Last Month = DATE (YEAR ( EOMONTH ( TODAY (), -1 ) ), MONTH ( EOMONTH ( TODAY (), -1 ) ), DAY ( EOMONTH ( TODAY (), -1 ) ) )

A calculated column for him to check if it is last month without entering the filter context:

Is Last Month = Table[Date] >= DATE(YEAR(Table[Last Month]), MONTH(Table[Last Month]), 1) && Table[Date] <= Table[Last Month]

Measure to return the average of the last month:

Last Month Average =
CALCULATE(
     AVERAGE(Table[Value]),
     Table[Is Last Month]
)

I'm not able to filter today's date by day of the week.

enter image description here

powerbi

powerbi-desktop

0 Answers

Your Answer

Accepted video resources