Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
Table 1 is calendar table but so far i did not connect the date table created date with the date calendar date so no relationship with the data table housing sales orders
Measure in place is YTD present year and YTD prior year(using time intelligence)
Goal is not to get year over year only but only year over year through today
such as sales YTD 2024 is calculated only through 4/20/24 so it compares to sales through YTD 4/20/25 present year
What is cleanest dynamic solutioni tried using var filter then calculate but no success as it continues to give me april 2024 all month instead of only through april 20, 2024 total
one note is data table has a parsing date column too
calendar table name is Date Table
sales order table name is Sales Table
sales table below showing order created date and the 3 measure below using created date
Solved! Go to Solution.
Connect your tables first and get in the habit of using a date table. Simplist way to get there:
Current Year
Sales YTD Through Today :=
VAR TodayDate = TODAY()
VAR YearStart = DATE(YEAR(TodayDate), 1, 1)
RETURN
CALCULATE(
SUM('Sales Table'[Sales Amount]),
DATESBETWEEN('Date Table'[Date], YearStart, TodayDate)
)
Prior year to Date:
Sales YTD Through Same Day Last Year :=
VAR TodayDate = TODAY()
VAR LastYearSameDay = TODAY() - 365 // Adjust if leap year logic needed
VAR YearStartLY = DATE(YEAR(LastYearSameDay), 1, 1)
RETURN
CALCULATE(
SUM('Sales Table'[Sales Amount]),
DATESBETWEEN('Date Table'[Date], YearStartLY, LastYearSameDay)
)
Please mark this post as solution if it helps you. Appreciate Kudos.
now it works-issue was data table needed to have parse date linked to cal datble date not created date linked from data table as the created date data table had been parsed prior
Connect your tables first and get in the habit of using a date table. Simplist way to get there:
Current Year
Sales YTD Through Today :=
VAR TodayDate = TODAY()
VAR YearStart = DATE(YEAR(TodayDate), 1, 1)
RETURN
CALCULATE(
SUM('Sales Table'[Sales Amount]),
DATESBETWEEN('Date Table'[Date], YearStart, TodayDate)
)
Prior year to Date:
Sales YTD Through Same Day Last Year :=
VAR TodayDate = TODAY()
VAR LastYearSameDay = TODAY() - 365 // Adjust if leap year logic needed
VAR YearStartLY = DATE(YEAR(LastYearSameDay), 1, 1)
RETURN
CALCULATE(
SUM('Sales Table'[Sales Amount]),
DATESBETWEEN('Date Table'[Date], YearStartLY, LastYearSameDay)
)
Please mark this post as solution if it helps you. Appreciate Kudos.
User | Count |
---|---|
45 | |
32 | |
30 | |
27 | |
25 |
User | Count |
---|---|
55 | |
55 | |
35 | |
33 | |
28 |