Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rlupe
Frequent Visitor

How to calculate for an alternate date (same fiscal day last year)?

What DAX formula can I use to sum sales for the same fiscal day last year? My date table has a column fiscaldaylastyear_date, so if my data is on 1/1/2023, the fiscal day last year column would be 1/2/2022.

 

I want to be able to show the fiscal last year sales on the corresponding date.

rlupe_0-1699370300922.png

 

4 REPLIES 4
JohnnySaade
Helper I
Helper I

Create an inactive relationship between your sales table date column and the calendar table fiscal date LY column. Then write this measure:

CALCULATE( SUM(Sales[Sales Amount]), USERATIONSHIP(Sales[Date],Calendar[fiscalDateLY]) )

this will make sure that your sales will always recalculate according to the fiscal date last year column

I made the relationship, but it is still displaying the This Year sales. Might have to do that I have to use Many to Many relationship instead of Many to One due to blanks in the fiscal day last year column. 

amitchandak
Super User
Super User

@rlupe , Make sure you have date table joined with date of your table and then try

 

Example measure

week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

This does work, however I was trying to do something more dynamic because I need to do this for 15 sales measures and would have to adjust each next year with the new calendar. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.