Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Yield-1Y = CALCULATE(SUM('US Treasury'[Yield]),DATEADD('US Treasury'[Date],-1,YEAR))
or
Yield-1Y = CALCULATE(SUM('US Treasury'[Yield]),SAMEPERIODLASTYEAR('US Treasury'[Date]))
How can I ask it to get the latest available data before last year if last year appears to have blank data eg its a holiday or weekend?
Hi, @lxmnl
Getting the data for the same period last year is not difficult to implement, but if additional judgments are needed for working days, more complex logic may be required.
You can try using the LASTNONBLANKVALUE function to get help.
https://community.powerbi.com/t5/Desktop/LASTNONBLANKVALUE-challenging-problem/m-p/1749034
Or consider using other similar time functions, such as Dateadd, EDATE and other functions
https://databear.com/power-bi-dax-sameperiodlastyear-paralellperiod-and-dateadd/
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@lxmnl , first you should date table with time intelligence
Do you want to work with only working days?
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Check this example
Traveling Across Workdays - What is next/previous Working day
https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calenda...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |