Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have daily sales data over the years and I am trying to see the yearly sales trend. I am tring to calculate the
Total revenue as measure
Previous year revenue as measure
YOY as measure but while taking the YOY increase or decreasing in the graphical area everthing is blanking out and it shows Error fetching the data for the visual.
Can someone help me on what is the mistake that i am making
Solved! Go to Solution.
Hi @Jinc
In the error it's clearly stating that 'Year'[Year ] is not a Date Column, which means it has 2023, 2024, 2025 values basically these are Whole Number data type.
To achive your requirement please follow the below stpes
1. Create a proper Date table
2. Example of Date Table, you can add your own columns if required.
Date =
ADDCOLUMNS(
CALENDAR(MIN('2019-2025 Details'[Date]), MAX('2019-2025 Details'[Date])),
"Year", YEAR([Date]),
"Month Number", MONTH([Date]),
"Month Name", FORMAT([Date], "MMMM")
)3. Mark it as a Date Table in Power BI, Modeling --> Mark as Date Table --> select the [Date] column.
4. Create separte measures for CY, LY and YoY
Total Revenue = SUM('2019-2025 Details'[Amount])Revenue Last Year = CALCULATE( [Total Revenue], SAMEPERIODLASTYEAR('Date'[Date]))YoY Revenue Growth % = DIVIDE([Total Revenue] - [Revenue Last Year], [Revenue Last Year])
Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.
Looks like the error message gives the answer. The parameter of SAMEPERIODLASTYEAR must be of type DATE. You should check and change the data type of 'Year'[Year].
Hi @Jinc
In the error it's clearly stating that 'Year'[Year ] is not a Date Column, which means it has 2023, 2024, 2025 values basically these are Whole Number data type.
To achive your requirement please follow the below stpes
1. Create a proper Date table
2. Example of Date Table, you can add your own columns if required.
Date =
ADDCOLUMNS(
CALENDAR(MIN('2019-2025 Details'[Date]), MAX('2019-2025 Details'[Date])),
"Year", YEAR([Date]),
"Month Number", MONTH([Date]),
"Month Name", FORMAT([Date], "MMMM")
)3. Mark it as a Date Table in Power BI, Modeling --> Mark as Date Table --> select the [Date] column.
4. Create separte measures for CY, LY and YoY
Total Revenue = SUM('2019-2025 Details'[Amount])Revenue Last Year = CALCULATE( [Total Revenue], SAMEPERIODLASTYEAR('Date'[Date]))YoY Revenue Growth % = DIVIDE([Total Revenue] - [Revenue Last Year], [Revenue Last Year])
Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.
This worked, thanks for the help. I was actually cretaing measure in the wrong table which is the sales table in place of the year table. Thanks again for the codes and the steps
Thank you for the prompt response, for some reason the revenue of last year it showing the same revenue and not of the previous year thus when taking the %age increase it is showing 0% for all years
Did you follow the same steps what I mentioned ? else you can share sample data of .pbix file by using insert link optionof any cloud platform.
Hi @Jinc ,
would you like to share your measures and the exact error message? That would help.
Did you check already if your measured work if you assign them to a table or matrix?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 71 | |
| 50 | |
| 47 | |
| 44 |