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.
Hi Guys
I wanted to know how can we calculate Previous fiscal year total sales.Currently my YTD dax is: TOTALYTD(SUM(Table1[Sales]),Date[Date],ALL(Date),"3/31")
Please help
To be able to carry out fiscal year calculations you have to have a fiscal calendar set up. Once you have it, you can use this formula:
[Total Sales PFY] =
// There must be a hidden integer field in the Calendar
// called FiscalYearNumber.
var __currentFiscalYear = SELECTEDVALUE( Calendar[FiscalYearNumber] )
var __totalpfy =
calculate(
[Total Sales],
Calendar[FiscalYearNumber] = __fiscalYear - 1
)
return
__totalpfy
This is the only way to deal with fiscal calendars - you have to have a proper one in the model and write the logic yourself. There is no fiscal time-intel built-in because there are too many ways to have fiscal calendars set up whereas there is only one standard calendar.
Best
D
@AnonymousCan you help me creating that table?
Try This
Hope this will work
Total Sales LY = CALCULATE( [Total Sales], DATESYTD( Dates[Date] ) )
@Anonymous thanks for the artilce!
Hello @Anonymous
Try following measures:
Total Orders = SUM(dtTable[Order Quantity])
YTD Orders = CALCULATE([Total Orders],DATESYTD('Calendar'[Date],"3/31"))
YTD Prev Year = CALCULATE([YTD Orders], SAMEPERIODLASTYEAR('Calendar'[Date]))
It will give you the desired output.
Cheers!
Vivek
If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂
https://www.vivran.in/
Connect on LinkedIn
@vivran22 Thanks for the solution but again my YTD is coming out correct but the Previous Year is not coming out correct.Can't figure out why
@Anonymous Can you share the sample data file?
Cheers!
Vivek
https://www.vivran.in/
Connect on LinkedIn
Let's assume your current YTD measure works as you would like.
YTD = TOTALYTD(SUM(Table1[Sales]),Date[Date],ALL(Date),"3/31")
Create a New Measure -
YTD LY = CALCULATE( YTD, DATEADD( dDATES[DATE], -1, YEAR )
@AlexAlberga727Not working its just returning me the previous calendar year .Please note that my YTD measure is working fine according to my FY year.
try sameperiodLastyear.
Thanks,
Pravin
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 |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
46 | |
39 | |
19 | |
19 |