The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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!
@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))
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!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
80 | |
71 | |
51 | |
50 |
User | Count |
---|---|
129 | |
123 | |
78 | |
64 | |
60 |