Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Solved! Go to Solution.
hi @powerbricco
Instead of using DATEADD, why not use SAMEPERIODLASTYEAR?
Note: Dates table must be marked as such.
Hi @powerbricco, have you tried to use SAMEPERIODLASTYEAR Dax Function? You may want to use MTD as well
hi @powerbricco
Instead of using DATEADD, why not use SAMEPERIODLASTYEAR?
Note: Dates table must be marked as such.
@powerbricco You need to adjust your measure to account for the number of days that have passed in the current month.
Create a measure to calculate the total sales up to the current day in the current month:
DAX
[IMP. RIGA TOT. YTD] =
CALCULATE(
[IMP. RIGA TOT.],
DATESBETWEEN(
CalendarTable[Date],
STARTOFMONTH(CalendarTable[Date]),
MAX(CalendarTable[Date])
)
)
Create a measure to calculate the total sales up to the same day in the previous year:
DAX
[Total Sales_PY_Sameday YTD] =
CALCULATE(
[IMP. RIGA TOT.],
DATESBETWEEN(
CalendarTable[Date],
SAMEPERIODLASTYEAR(STARTOFMONTH(CalendarTable[Date])),
SAMEPERIODLASTYEAR(MAX(CalendarTable[Date]))
)
)
Adjust your variation % measure to use these new measures:
DAX
[Total Sales_PY% PY] =
IF (
ISBLANK(DIVIDE(
([IMP. RIGA TOT. YTD] - [Total Sales_PY_Sameday YTD]),
[Total Sales_PY_Sameday YTD]
)),
0,
DIVIDE(
([IMP. RIGA TOT. YTD] - [Total Sales_PY_Sameday YTD]),
[Total Sales_PY_Sameday YTD]
)
)
Proud to be a Super User! |
|
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
85 | |
79 | |
54 | |
39 | |
35 |
User | Count |
---|---|
102 | |
80 | |
48 | |
48 | |
48 |