This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
So I am trying to write the query where I need the average of ratings from previous year to compare with current year.
The dataset has dates for past 5 years. How can I get the average for last year, last week compare to this year. I am writing something like this
LYR =
AVERAGEX(
KEEPFILTERS(VALUES('Table_F'[Inbound_Outbound])), # this is the filter so ratings are segregated in inbound and outbound
CALCULATE(AVERAGE('[Rating]))
)
This is the output I am getting for average for all the years (ca/ea are the inbound and outbound channels) now this is YTD ratings, I need it to split it by year e.g average ratings for current year then append it to avg rating for 2021
Can you show the desired output in excel by exporting this data in excel
| Channel | Rating | LY Rating | LY Variance | LW Rating | LW Variance |
| CA | 4.69 | 4.77 | -0.07 | 4.76 | -0.07 |
| EA | 4.70 | 4.86 | -0.16 | 4.87 | -0.17 |
| 4.70 | 4.81 | -0.11 | 4.82 | -0.12 |
Hi mh2587, thanks for getting back to me. But it doesnt help with the filters required
Can elaborate further with your desire output and what filter you required with screenshots or something else
So basically I need in columns:
Current avg rating, last year's rating, variance, last week ratings & Variance
Hi @Anonymous ,
Please try the following formula:
LY Rating =
CALCULATE (
[Rating],
KEEPFILTERS ( VALUES ( 'Table_F'[Inbound_Outbound] ) ),
DATESINPERIOD ( Dates[Date], MIN ( Dates[Date] ) - 1, -1, YEAR )
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Unfortunately its not working for me and giving me an error
"A single value for column 'Star_Rating' in table cannot be determined. a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 26 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 68 | |
| 36 | |
| 32 | |
| 25 | |
| 23 |