Forum Discussion
RANK with PARTITION BY Like SQL
- 1 year ago
The newer RANK function should make this easier than it used to be.
Try this:
RANK ( DENSE, ORDERBY ( 'Table'[Date], ASC ), PARTITIONBY ( 'Table'[ID] ) ) - 1 year ago
Calculate column on Table, where you add a column to calculate the year
Year = YEAR ( Tabella[Date] )
Finale Column
RANK ( DENSE, ORDERBY( Tabella[Date] ), DEFAULT, PARTITIONBY( Tabella[YEAR]))If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your threadconsider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Hi mate,
A new column, which ranks the dates grouped by each ID.
The actual date value is irrelevant, I just want the earliest to be 1 for each ID, and the second 2, and so forth.
Calculate column on Table, where you add a column to calculate the year
Year = YEAR ( Tabella[Date] )
Finale Column
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your threadconsider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI