Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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).
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?
Solved! Go to Solution.
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:
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.
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:
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!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
85 | |
84 | |
67 | |
49 |
User | Count |
---|---|
131 | |
111 | |
97 | |
71 | |
67 |