sameperiodlastyear
19 TopicsSAMEPERIODLASTYEAR not giving correct results
Hi, I'm having some troubles with my SAMEPERIODLASTYEAR calculations. I'm trying to compare the first 3 days of March '26 against the same period for last year using SAMEPERIODLASTYEAR, but what I get is the total amount of March '25. The formula I'm using is: Sales Y-1 = CALCULATE( SUM( SalesAnalysis[Sales Amount] ), SAMEPERIODLASTYEAR( Calendar[Date] ) ) I created the Calendar table and set it as Date table Also, I've already tried adding ALL( Calendar[Date]) since I'm filtering the visual using a slicer with Calendar[Date] as data field; but that didn't work. SalesAnalysis table is linked to the Calendar by SalesDate column Thanks in advance for your help!Solved642Views0likes5CommentsNeed Urgent Help on SamePeriodLastYear
Dear Pros, Can you please help me to calculate the below? I have the sales data of 2024 & 2025 in the same table. 1. I want to calculate the difference between 2025 month on month data and 2024 month on month. 2. I want to calcuate the % differece between 2025 month on month data and 2024 month on month. I also have the categories and subcategories, I want difference based on these level as well. I want to show the result in a clustered column char ThanksSolved1.4KViews0likes11CommentsReturn last year YTD value based on slicers/filters
Below is an example of dataset. Date Product Country Revenue 12/31/2021 A China 10 03/31/2022 A Mexico 20 06/30/2022 C US 10 09/30/2022 B Mexico 10 09/30/2022 B US 10 09/30/2022 B US 10 10/31/2022 B Japan 10 10/31/2022 A Japan 10 12/31/2022 A China 10 03/31/2023 A Thailand 10 06/30/2023 A Japan 10 09/30/2023 C Vietnam 10 10/31/2023 A US 10 10/31/2023 A US 10 10/31/2023 A US 10 10/31/2023 A US 10 10/31/2023 B Japan 10 There are slicers for Year and Quarter I have created one page that only display graphs for Product A. I want to create a measure that can return previous year YTD value based on slicer selection. For example, I select 2023 Q4 on slicers, the last date is 10/31/2023. The measure should return $10 for previous YTD revenue (i.e. 10/01/2022 to 10/31/2022). Any advice is appreciated. Thanks!Solved566Views0likes1CommentSame Period Last Year - Full Year & PiT in same table
Hi, I'm looking to two sale previous year measures in the same column. Sales for the full year and sales to the same day last year. Normally I wouldn't have the need to include both in a table, and would have two cards using the following simple DAX. Sales Same Period Last Year = CALCULATE([Amount Measure], SAMEPERIODLASTYEAR('Date Table'[Date])) ...and to display sales to the same day last year, I would drop in calculated column as a visual level filter for Is Today or Before = True How can I amend the DAX above so that it only calculates to the sameperiod last year? Have tried a few amendments suc as TODAY but no luck.1.7KViews0likes8CommentsRANKX and SAMEPERIODLASTYEAR
Hi all, I'm new to the forum and would appreciate some help. I have Filters on all pages, that the end user can choose for either date range, and/or segment. I have created a RANKX measure, which uses those filters. I want to see which individuals are costing the most in repair costs, by segment, for the date period chosen. (The DateKey is used as there are a few different date fields in the model). This is the DAX I've written to do that: Individual Ranked Total Repair Costs = CALCULATE( RANKX(ALL('Repair Data'[Individual Name]), [Total Repair Costs],,DESC), ALLSELECTED('Repair Data'[Segment]), ALLSELECTED('Calendar'[DateKey])) It gives me the results I expect. I want to compare this to the SAMEPERIODLASTYEAR, however when I try to use SAMEPERIODLASTYEAR, it's showing the previous year's costs for those ranking in the original timescale rather than giving me new individuals ranked for the previous period... Individual Ranked Total Repair Costs LY = CALCULATE( RANKX(ALL('Repair Data'[Individual Name]), [Total Repair Costs],,DESC), ALLSELECTED('Repair Data'[Segment]), ALL('Calendar'[DateKey]), SAMEPERIODLASTYEAR('Calendar'[DateKey])) Any thoughts?? Thank you all!Solved1KViews0likes4CommentsHow to calculate avg price for the same period last year for sum totals in Dax
I have a table of Invoices that are for different products over multiple years. I am attempting to get the previous years avg price for each item by dividing the Calculate(Sum(sales)/Sum(qtyShipped),SamePeriodLastYear(DateDim[Date])) When I do this calculation I get NaN returned. If I change the SamePeriodLastYear to ParallelPeriod(DateDim[Date],-12,Month) I get a 0 value. In Power BI i'm building the Matrix by Rows: Item Month Columns: Year Values: Qty Shipped Total Sales Avg Price (Totalsales/qtyshipped) Previous Years avg Price (I want this to be the samePeriodlastyear of the totalSales/Qtyshipped) There is one more hiccup in here. If the previous year has a 0 value for the avg price I want it to use the current year as the pervious years avg price. This is an example of the table I am attempting to return in powerbi except with a column that will in the previous years avg price. These number are not correct it is just a dummy data table.Solved495Views0likes1CommentHelp with SAMEPERIODLASTYEAR
Happy new year all! I am trying to use the SAMPERIODLASTYEAR function to count records from the previous year, so that I can compare them to the number of records for the current year (up until today's date). The problem I am running into is that the same day last year is counting records for the entire month, rather than just that corresponding day. I have a field in my Date table [check] which checks the day number of the year so future days in the same month can be filtered out. Any help to resolve this would be greatly appreciated. Many thanksSolved1KViews0likes4CommentsSame period last year
Hello together I am currently trying to apply YTD to last year. Unfortunately, this works neither with "sameperiodlastyear" nor with a "Dateadd" filter. I would like to display the current value (YTD) and the last year in an identical period in a bar chart. The following formula works with a slicer: = CALCULATE(SUM(TBL_Sales)]),SAMEPERIODLASTYEAR('Date Slicer Choice'[Date])) But I want to solve this without a slicer on the dashboard. does anyone have a tip for me? THX a lot Regards,577Views0likes2CommentsSAMEPERIODLASTYEAR not working on previous year
Hi, I'm pretty new to PowerBI and I appreciate this forum to share experiences. I've a problem with a measure not displaying the correct value. I've a fact table called Summary in which I've the field [Prepared Quantity] on wich I've created this measure: Deliberated Lines TOT = CALCULATE(SUM('Summary'[Prepared Quantity]), GROUPBY('Summary','Summary'[Planned Delivery Date],'Summary'[Shipment Type],'Summary'[FLG Prep])) where [Planned Delivery Date] is a non-unique field of type date. What I would like to do is displaying the same value but one year before the selected date or the date in the visual row. I tried to use the SAMEPERIODLASTYEAR with [Planned Delivery Date] but it gave me an error because the date rows are not unique. So I added a calendar table in order to do that and I linked the [Planned Delivery Date Id] field to the calendar key of the calendar dimension. After that I've created this measure: Deliberated Lines TOT Previous Year = CALCULATE('Summary'[Deliberated Lines TOT],ALL('Calendar'[Date Value]),SAMEPERIODLASTYEAR('Calendar'[Date Value])) but it shows me the same value of the [Deliberated Lines TOT] measure. Here's a screenshot: What I'm doing wrong? Thanks in advanceSolved4.5KViews0likes3CommentsDAX - measurements in past periods
I need to automate the measures below to show according to the column period: Receita Liquida NET = VAR varOrderContexto = MAX('Esqueleto DRE'[Ordem]) Return CALCULATE( [Realizado], FILTER( ALL('Esqueleto DRE'), 'Esqueleto DRE'[Ordem]<=varOrderContexto ), NOT( ISBLANK('Esqueleto DRE'[Ordem]) ), FILTER( ALL('Esqueleto DRE'), 'Esqueleto DRE'[Ordem]=1 ))428Views0likes1Comment