Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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! |
|
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |