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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi Team,
Am creating new measures based on year column.
Measure 1:
Solved! Go to Solution.
Hi @Anonymous ,
SAMEPERIODLASTYEAR takes date column as input, but you are just giving it year part of your date.
Check details here:
https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
Thanks,
Pragati
Hi @Anonymous
The error detail has shown the reason, 'Sales Data'[Year] is not Date type.
Is 'Sales Data'[Year] a Whole number type column with values like 2020, 2021?
Try to update your measure as below.
PY Revenue = CALCULATE([CY Revenue],Filter(All(Sales Data),'Sales Data'[Year] = MAX('Sales Data'[Year])-1))
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for response.
Have converting datetime field into year in SQL like bellow.
YEAR([Order Date]) [Year]
Hi @Anonymous ,
SAMEPERIODLASTYEAR takes date column as input, but you are just giving it year part of your date.
Check details here:
https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
Thanks,
Pragati
User | Count |
---|---|
98 | |
76 | |
74 | |
49 | |
26 |