Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Greetings All -
I need to calculate previous fiscal year to date sales data by sales category based on our our fiscal year. It starts September 1st, ends August 31st. I have my sales table related to a date table and have created a measure to calculate the current FY23 fiscal year to date sales - 9/1/2022 to today (4/5/2023). This measure works correctly and I'm able to display the data in a standard table. However, when I try to calculate the previous year's fiscal year to date sales, I'm getting incorrect results. As a test, I created a table from our total sales column and manually contrained it to show sales from 9/1/2021 - 4/5/2022, and the numbers are correct. Here's what the FY22 sales data for that date range should be:
The correct current FYTD measure is:
I know I've got either a function or some syntax messed up but don't know what it is. What am I missing?
Thank you.
A few questions that could help figure out why this isn't working for you:
What this measure does is finds the value calculated from the previous data point, ignoring any filters placed on a date column.
Hi Alex -
Yes, you're correct, I do have an active relationship between the date table (Calendar Date) and the Date Key column in the sales table. And for other calculated columns/measures in the report that relationship is functioning as expected. Still haven't figured out why it wasn't working for this particular operation. I inherited most of this report and there are/were many tangled columns/measures spanning about a dozen other tables so my guess is that may have something to do with this and other issues I've been dealing with. I have the report mostly working at this point and the execs are fine with it as it is. I'd still like to get this figured out though as there'll be a need to perform these types of calculations in the future with other reports. Thanks for the DAX suggestion, I'll give that a try.
Thank Bmejia, I do have a date table with a number of columns for doing various fiscal year related operations:
As I mentioned in a reply to Alex_Sawdo, I have the report mostly working at this point. However, I'll do some experimenting with the DAX you provided to see if it helps. Thank you again for all of your suggestions, much appreciated.
If you can provide a sample of your data.
Your Previous year should look something like this, It seem like your calling YTSales4 Again.
PY=CALCULATE(SUM('Sales'[Total Sales Amount]),SAMEPERIODLASTYEAR('DateTable'[Calendar Date]))
Thanks Bmejia, but that doesn't work either. This gives values that are much too large because I think it's not limiting the sales data to just the date range 9/1/2021 - 4/5/2022.
How about
That measure doesn't throw any errors, but it still doesn't provide the correct values for the fiscal YTD sales for FY22. I get the exact same values that are too low that I showed above. Having a hard time understanding why a calculation that should be relatively straightforward is proving so difficult to do in PBI. Is there some row level context I'm missing in my DAX?
Hi,
Was this resolved in the end?
Thanks
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
81 | |
52 | |
39 | |
35 |
User | Count |
---|---|
95 | |
79 | |
52 | |
49 | |
47 |