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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
bilalali87
Frequent Visitor

Total Bookings Same Days Prior

Hey guys,

 

I have two tables set up, one which shows the dates possible to make bookings in the current year, and one which shows the dates it was possible to make bookings in a previous year. In two separate tables I have the booking details for each years events (both have relationships set up).

 

DaysPrev.pngDaysCur.png

 

What I'm subsequently trying to do is take the days prior to the current years event (based on the current date) and fetch the booking figure from the same days prior in last years figures - so if I'm 7 days out from this years event, I want to see what bookings were like 7 days out from the previous years event to draw comparisons - and display this total in a Card visual.

 

So far I've tried the below without success;

 

PrevYearBTD = 
VAR DaysPriorTY = MAX('Current'[Days Prior])
VAR DaysPriorLY = LOOKUPVALUE(DatesPrevious[Days Prior], DatesPrevious[Date], TODAY()-365)
VAR BookingsLY = DISTINCTCOUNT ( 'Previous'[User Id] )

RETURN
IF(DaysPriorLY=DaysPriorTY, BookingsLY, 0)

 

Any ideas on best way to achieve this?

 

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @bilalali87 ,  

 

You could create a measure by the following formula: 

PrevYearBTD =
CALCULATE (
    DISTINCTCOUNT ( Previous[User Id] ),
    FILTER (
        ALL ( 'Previous' ),
        [Date]
            >= TODAY () - 365 - 7
            && [Date]
                <= TODAY () - 365
    )
)

The final output is shown below:  

v-yalanwu-msft_0-1622527293635.jpeg

If it's not right, please provide me with more details or share me with your .pbix file after removing sensitive data.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi @bilalali87 ,  

 

You could create a measure by the following formula: 

PrevYearBTD =
CALCULATE (
    DISTINCTCOUNT ( Previous[User Id] ),
    FILTER (
        ALL ( 'Previous' ),
        [Date]
            >= TODAY () - 365 - 7
            && [Date]
                <= TODAY () - 365
    )
)

The final output is shown below:  

v-yalanwu-msft_0-1622527293635.jpeg

If it's not right, please provide me with more details or share me with your .pbix file after removing sensitive data.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

Thanks @v-yalanwu-msft I took your suggestion, tweeked slightly and its now working!

lbendlin
Super User
Super User

There's a fantastic video that you will want to watch.

 

https://youtu.be/mHb5iyV01D4

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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