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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register 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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.