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,
Im looking to create sales totals by vendor and month, as well as prior year, current YTD and prior YTD. For Prior Year, im using:
Prior Year = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date Table'[Date]))
However, when i run this i only get the total prior year, and it isnt broken down by specific vendor. Is there a portion of DAX im missing to make this happen?
Thanks!
Solved! Go to Solution.
@Greg_Deckler Thanks! I was able to fix this by examining the relationships a bit more. It seems my filtering criteria was using the dates from the Sales table, not the joined calendar table. Once I changed that to run off the calendar table, all worked as expected! Appreciate the help
@Anonymous - My guess is that you have something in your [Total Sales] measure calculation that is causing this. Probably an ALL statement or something like that. Can you post the code for [Total Sales]?
Hi @Greg_Deckler, thanks for the reply. Im using a very simple formula for total sales:
Total Sales = SUM('Detail Reports'[Amount])
Ive tried using just the SUM() within the Prior year calculation as well, and that doesnt work either.
@Anonymous - Hmm, maybe a missing relationship? It's difficult to say wihtout understanding your data model and how you are using these things in visuals. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
@Greg_Deckler Thanks! I was able to fix this by examining the relationships a bit more. It seems my filtering criteria was using the dates from the Sales table, not the joined calendar table. Once I changed that to run off the calendar table, all worked as expected! Appreciate the help