Forum Discussion
PowerBI87
6 years agoFrequent Visitor
Column to Calculate Year
Hi, Can i please get help to write a function that will output the column in the right? Company Product Year Output ABC Corp A 2017 First Year GHY Corp A 2018 First Year ...
- 6 years ago
Hi PowerBI87
try to create column
Output = var r = RANKX(FILTER(ALL('Table'), 'Table'[Company] = EARLIER('Table'[Company]) && 'Table'[Product] = EARLIER('Table'[Product])), 'Table'[Year], , ASC) var textRank = SWITCH(r, 1, "First", 2, "Second", 3, "Third", BLANK()) RETURN textRank & " Year"Q
parry2k
6 years agoSuper User
PowerBI87 add a column with following expression
Output =
VAR __minYear = CALCULATE ( MIN ( Table[Year] ), ALLEXCEPT ( Table, Table[Company] ) )
RETURN Table[Year] - __minYear ) + 1
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡