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

Create summary table with SAMEPERIODLASTYEAR

Hi,

 

I am trying to create Summary table with last year sales using SAMEPERIODLASTYEAR. but Sales PY is coming blank.

 
Invoice Summary = SUMMARIZE('Invoice Data','Invoice Data'[DIVISION_NAME],'Invoice Data'[PARENT_CUST],'Invoice DM'[FISCAL_YEAR_NAME],"Sales", [Sales1], "Sales PY", [Sales PY1])

 

Sales1 = SUM('Invoice Data'[SHIP_AMT])
Sales PY1 = CALCULATE([Sales1],SAMEPERIODLASTYEAR('Invoice DM'[DATE_VALUE]))
 

Thanks

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Thank you for your sample data, please modify Sales PY1 as below.

Sales PY1 = CALCULATE([Sales1],FILTER(ALLEXCEPT('Invoice Data','Invoice Data'[Parent_Customer]),'Invoice Data'[Invoice_Date].[Year]=SELECTEDVALUE('Invoice Data'[Invoice_Date].[Year])-1))

Pbix as attached.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

5 REPLIES 5
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Thank you for your sample data, please modify Sales PY1 as below.

Sales PY1 = CALCULATE([Sales1],FILTER(ALLEXCEPT('Invoice Data','Invoice Data'[Parent_Customer]),'Invoice Data'[Invoice_Date].[Year]=SELECTEDVALUE('Invoice Data'[Invoice_Date].[Year])-1))

Pbix as attached.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

For time intelligence function to work best, create a date table join table. then try

Sales PY1 = CALCULATE([Sales1],SAMEPERIODLASTYEAR('Date'[Date]))

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Anonymous
Not applicable

@amitchandak  Invoice DM is my date table

v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please share some sample data and excpeted result to us if you don't have any Confidential Information.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

@v-jayw-msft please see sample data below, i have Invoice data and i expect invoice summary as shown below

 

invoice Data:

Division NameParent CustomerInvoice Dateship amt
ABCDA1/1/2018100
ABCDA1/1/2018100
ABCDA1/1/2019100
ABCDA1/2/2019100
ABCDA1/3/2019100
ABCDA1/4/2019100
ABCDA1/5/2019100
ABCDA1/1/2020100
ABCDA1/2/2020100
ABCDB1/1/2018100
ABCDB1/2/2018100
ABCDB1/1/2019100
ABCDB1/2/2019100
ABCDB1/1/2020100
ABCDC1/1/2018100
ABCDC1/2/2018100
ABCDC1/1/2019100
ABCDC1/2/2019100
ABCDC1/1/2020

100

 

Invoice Summary

Division NameParent CustomerInvoice Yearsalessales py
ABCDA20182000
ABCDA2019500200
ABCDA2020200500
ABCDB20182000
ABCDB2019200200
ABCDB2020100200
ABCDC20182000
ABCDC2019200200
ABCDC2020100200

 

Thanks

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.