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
This is about to calculate the Sales Amount,
Im using a date slicer from date to to date (1-1-2018 to 5-3-2018) and getting the sales amount for this period ,but i could not able to get the sales amount for the same period in the last year (i e.1-1-2017 to 5-3-2017).
Simply i need to create a measure to calculate the Sales Amount exactly same period of the last year of the current selection.
Can some one help me?
Solved! Go to Solution.
Hi @Anonymous,
You could follow the steps below to get your excepted result.
1. You should create a DateTable and create a relationship between the DateTable and Amounts table.
DateTable = CALENDARAUTO()
2.You could create the measure below to get your desired result.
lastyear_Amount =
CALCULATE (
SUM ( Amounts[sales Amount] ),
SAMEPERIODLASTYEAR ( 'DateTable'[Date] )
)
Then you will get the result below.
For details, you could refer to my test pbix file.
Best Regards,
Cherry
Hi @Anonymous,
You could follow the steps below to get your excepted result.
1. You should create a DateTable and create a relationship between the DateTable and Amounts table.
DateTable = CALENDARAUTO()
2.You could create the measure below to get your desired result.
lastyear_Amount =
CALCULATE (
SUM ( Amounts[sales Amount] ),
SAMEPERIODLASTYEAR ( 'DateTable'[Date] )
)
Then you will get the result below.
For details, you could refer to my test pbix file.
Best Regards,
Cherry
Hi @v-piga-msft,
Thank you for the valuable reply.I have already applied the same logic but i got another challenge Power BI does not support the Calendar table in direct query method.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |