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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
imminent
New Member

how to select date and use the date selected for other calculation

Hi, I am a new user in PBI, I am trying to figure something out. able 1 has only unique calendar dates, table 2 has multiple dates with sale numbers for comparison. These two tables are connected through model. 

 

I would like user to select a date through date slicer( this is currently through date dim) connected to table using model (date as unique key, one to many) and ;

I would like to calculate for 2 other dates bsed on user's selection, previous date, previous week date(to do this, how can it be done?)

 

Through user selected dates, I am would like to be able to compare day on day, numbers from fact table. 

 

 

2 REPLIES 2
Arul
Super User
Super User

@imminent ,

try these measures,

1. Previous Day

Previous day sales = 
CALCULATE(
    SUM(Sales[Sales]),
    PREVIOUSDAY('Date'[Date]))

2. Previous week
To get this done you need year and weekno column in your date dimension table,

Previous week sales = 
CALCULATE (
    SUM ( Sales[Sales] ),
    FILTER (
        ALL ( 'Date' ),
        'Date'[Year] = MAX ( 'Date'[Year] )
            && 'Date'[Weekno]
                = MAX ( 'Date'[Weekno] ) - 1
    )
)

Thanks,

Arul

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


TomMartens
Super User
Super User

Hey @imminent ,

 

I recommend reading this article: https://www.daxpatterns.com/time-patterns/

This article comprises almost everything that needs to be known about date calculations.

 

Hopefully, this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors