Forum Discussion
Anonymous
3 years agoNot applicable
Year to year difference
How do i calculate year to year diffrence if my data type is in a whole number and not in "date" datatype. I only have sales data for 2021 and 2022. There are no month and day data. Most of tutorial/solution that I watch use calendar(dim date). But in my case I used only years data only which is in whole number datatype.
2 Replies
- FreemanZ
Super User
hi Anonymous
supposing you have a table like:
Year Sales 2020 6 2021 8 2022 9 2023 8 try to add a calculated column like:
YoY = VAR _salespre = MAXX( FILTER( data, data[Year]=EARLIER(data[Year])-1 ), data[Sales] ) RETURN IF( _salespre<>BLANK(), [Sales]-_salespre )it worked like:
- FreemanZ
Super User
or you plot a table visual with the year column and a measure like:
YoY Measure = VAR _salespre = MAXX( FILTER( ALL(data), data[Year]=MAX(data[Year])-1 ), data[Sales] ) RETURN IF( _salespre<>BLANK(), MAX(data[Sales])-_salespre, "" )it worked like: