Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi all,
I´m trying to compare my YTD data (that I made a meassure and it´s working fine) to the same period last year.
Basically I want to compare the january-may 2018 vs january-may 2017.
When I create the new meassure LY YTD (see meassure below), I just get the total sales from last year and not the january-may 2017.
Can anyone help me with this issue?
Thanks.
Hi,
I suggest you do this.
Total Sales = CALCULATE(Data[Sales])
YTD Sales = CALCULATE([Total Sales],DATESYTD(Calendar[Date],"31/12")
LY YTD Sales = CALCULATE([YTD Sales],SAMEPERIODLASTYEAR(Calendar[Date]))
Please change the column names in the measure.
Hope this helps.
Hello @Mega79,
Do you mean for something like:
Where I've used the following:
Total = SUM(Table1[Value])
YTD Value = TOTALYTD( [Total],Table1[Date] )
Total LY YTD = CALCULATE( TOTALYTD([Total],Table1[Date]), SAMEPERIODLASTYEAR(Table1[Date]) )
Proud to be a Super User!
I'm still not getting a sum of last year YTD data... I only get the total.
Somehow it's taking the entire year. I don't know if the formula is writen correctly.
I guess you may need to show me the visual that you are trying to create as I do not understand.
My example could be visualized as:
How does your's need to be visualized?
Proud to be a Super User!
I need it to be visualized exactly as your exemple but when I do the meassure I don't get any data.
You can see the vusual below as a reference.
For last year YTD data I should get something close to the blue bar...
What if you tried:
Ventas LY YTD = CALCULATE(Sheet1[Ventas YTD],SAMEPERIODLASTYEAR(Sheet1[Fecha].[Date]))
Meaning remove the .[Date] from your Measure.
Proud to be a Super User!
I just erased the .[Date] from the meassure and still not getting any data.
I see Fecha is a function, what is the definition of Fecha?
The Data Type should be Date for Fecha.
Proud to be a Super User!
Fecha is only the date that I converted into the correct formart...
But I can also use the Recons_Date column which is the same as "Fecha" and I still don't get any data.
I just used both the .[Date] and without the .[Date] and somehow the filter SAMEPERIODLASTYEAR is not doing the job of isolated the ytd of last year.
In my example, all the Dates are the first of the month formatted to 'MMMM YYYY'.
I recall that the Time Intelligence functions require a proper dCalendar table related to your fact table.
Possibly, with my small dataset, I've managed to over come that small detail; as seen by my demonstration.
At this point, it would not hurt for you to create a proper dCalendar table since you are unable to acheive the desired results.
Use this modified code from https://exceleratorbi.com.au/build-reusable-calendar-table-power-query/ to quickly make a dCalendar that you can relate to your fact table (in Power Query Editor).
let Source = List.Dates(StartDate, Length, #duration(1, 0, 0, 0)), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}), #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}}), StartDate = #date(2000, 1, 1), Today = DateTime.Date(DateTime.LocalNow()), Length = Duration.Days(Today - StartDate), Custom1 = #"Changed Type" in Custom1
Proud to be a Super User!
I´ve created the calendar table as expleined in your link. Then I linked both the new calendar table with my sales table.
After that I created the meassure LY YTD but still getting the same result (the sum of last year) - see below
Hi,
Share the link from where i can download your file.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
124 | |
79 | |
50 | |
38 | |
38 |
User | Count |
---|---|
195 | |
80 | |
70 | |
51 | |
42 |