Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
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:
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:
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 13 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 25 | |
| 10 | |
| 10 | |
| 6 | |
| 6 |