Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Lookup Rating From Previous Quarter to See if Current Rating Has Changed

Hi,

 

I have a table containing ratings of different products from all quarters.

 

I want to be able to lookup the previous quarter rating (add that as a new column to my table) to do further calculations in the future, but I'm having trouble referencing the columns from my table variables.

 

Info: NewHelperQuarter is last quarter, [Rating] is string, and EARLIER is so that the filter selects all rows from that previous quarter.

 

Is there any way to make SELECTCOLUMNS return a single column instead of table? I remember @TomMartens talked about data lineage in this post Do any of you know how to solve this?

 

For example I have "Product A", I want the Q4 "Product A" to have the Q3 rating as an entry, the Q3 "Product A" to have the Q2 rating etc. for all quarters and all products (Product A - Z)

 

Thank you!image.png

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , if you have a date use Time intelligence. Else have separate table for Year Qtr and create a rank column on that, join back on year qtr

 

examples

 

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))


Qtr Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(ENDOFQUARTER('Date'[Date])))

Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))
Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),PREVIOUSQUARTER(('Date'[Date])))

 

new column

Qtr Rank = RANKX(all('Date'),'Date'[Year Qtr],,ASC,Dense) //YYYYQ

 

Measures
This Qtr = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])))
Last Qtr = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi! Thank you for the help. I was just wondering do the examples sum all the sales from that quarter? Because my rating values are like "BBB" and I don't want to sum up the previous quarter.

 

For example I have "Product A", I want the Q4 "Product A" to have the Q3 rating as an entry, the Q3 "Product A" to have the Q2 rating etc. for all quarters and all products (Product A - Z for example)

 

Thank you!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.