Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Help Needed with Prior Year totals grouped by Vendor

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!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@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

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@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]?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors