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
Hi I have two tables, one is a date table, another one is a sales table. These two tables are connected through Order Date (Sales table) to Date (Date table)
I have a measure as below, which gives me the value of fiscal year 2019 total sales $.
This Year Sales = calculate(sum('Sales Table'[Sales $]),filter(Date Table,Date Table[Date] <= Date Table[Fiscal Year 2019 End Date] && Date Table[Date] >= Date Table[Fiscal Year 2019 Start Date]))
In my design view, when I select a specific date from date table, the above measure will give me the sales $ for that date in 2019.
Now I would like also have another measure to give me the sales $ for (same date -364) in 2018.
For example, when select 1/1/2019, this year sales measure gives me the sales $ on 1/1/2019, and I would like to see the sales $ on (1/1/2019 -364) = 1/2/2018 from the new measure.
I have tried to use DAX with sameperiodlastyear, which this one gives me the value for 1/1/2018 instead of 1/2/2018. I think this sameperiodlastyear calculation is based on date minus 365, but I would make it as date minus 364.
Thanks in advance!!
Solved! Go to Solution.
@Anonymous ,
You may try DATEADD() function instead:
DATEADD(<dates>,<number_of_intervals>,<interval>)
https://docs.microsoft.com/en-us/dax/dateadd-function-dax
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous ,
You may try DATEADD() function instead:
DATEADD(<dates>,<number_of_intervals>,<interval>)
https://docs.microsoft.com/en-us/dax/dateadd-function-dax
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 36 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 74 | |
| 66 | |
| 65 |