Forum Discussion
Calculate Actual booking
- Anonymous1 year ago
Hi Peter2023
First, change the type of "Monthnumber"
Then try the following measure:Measure = VAR _month = SELECTEDVALUE('Date Lib'[Monthnumber]) VAR _current_booking = [Booking] VAR _current_cancel = [Cancel] VAR _current_retails = [Retails] VAR _previous_booking = SUMX(FILTER(ALL('Date Lib'),'Date Lib'[Monthnumber] <= _month-1),[Booking]) VAR _previous_cancel = SUMX(FILTER(ALL('Date Lib'),'Date Lib'[Monthnumber] <= _month-1),[Cancel]) VAR _previous_retails = SUMX(FILTER(ALL('Date Lib'),'Date Lib'[Monthnumber] <= _month-1),[Retails]) RETURN _current_booking + _previous_booking -_current_cancel - _current_retails -_previous_cancel - _previous_retailsResult:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous1 year ago
Hi Peter2023
First, use the following dax to get the week number:weeknum = WEEKNUM('Date lib'[Date])Then try the following Measure:
Actual booking = VAR _month = SELECTEDVALUE('Date lib'[Monthnumber]) VAR _week = SELECTEDVALUE('Date lib'[weeknum]) VAR _current_booking = [Booking] VAR _current_cancel = [Cancel] VAR _current_retails = [Retails] VAR _previous_booking_month = SUMX(FILTER(ALL('Date lib'),'Date lib'[Monthnumber] <= _month-1),[Booking]) VAR _previous_cancel_month = SUMX(FILTER(ALL('Date lib'),'Date lib'[Monthnumber] <= _month-1),[Cancel]) VAR _previous_retails_month = SUMX(FILTER(ALL('Date lib'),'Date lib'[Monthnumber] <= _month-1),[Retails]) VAR _previous_booking_week = SUMX(FILTER(ALL('Date lib'),'Date lib'[weeknum] <= _week-1),[Booking]) VAR _previous_cancel_week = SUMX(FILTER(ALL('Date lib'),'Date lib'[weeknum] <= _week-1),[Cancel]) VAR _previous_retails_week = SUMX(FILTER(ALL('Date lib'),'Date lib'[weeknum] <= _week-1),[Retails]) RETURN IF(ISINSCOPE('Date lib'[weeknum]),_current_booking + _previous_booking_week -_current_cancel - _current_retails -_previous_cancel_week - _previous_retails_week,_current_booking + _previous_booking_month -_current_cancel - _current_retails -_previous_cancel_month - _previous_retails_month)Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Peter2023
First, use the following dax to get the week number:
weeknum = WEEKNUM('Date lib'[Date])
Then try the following Measure:
Actual booking =
VAR _month = SELECTEDVALUE('Date lib'[Monthnumber])
VAR _week = SELECTEDVALUE('Date lib'[weeknum])
VAR _current_booking = [Booking]
VAR _current_cancel = [Cancel]
VAR _current_retails = [Retails]
VAR _previous_booking_month = SUMX(FILTER(ALL('Date lib'),'Date lib'[Monthnumber] <= _month-1),[Booking])
VAR _previous_cancel_month = SUMX(FILTER(ALL('Date lib'),'Date lib'[Monthnumber] <= _month-1),[Cancel])
VAR _previous_retails_month = SUMX(FILTER(ALL('Date lib'),'Date lib'[Monthnumber] <= _month-1),[Retails])
VAR _previous_booking_week = SUMX(FILTER(ALL('Date lib'),'Date lib'[weeknum] <= _week-1),[Booking])
VAR _previous_cancel_week = SUMX(FILTER(ALL('Date lib'),'Date lib'[weeknum] <= _week-1),[Cancel])
VAR _previous_retails_week = SUMX(FILTER(ALL('Date lib'),'Date lib'[weeknum] <= _week-1),[Retails])
RETURN
IF(ISINSCOPE('Date lib'[weeknum]),_current_booking + _previous_booking_week -_current_cancel - _current_retails -_previous_cancel_week - _previous_retails_week,_current_booking + _previous_booking_month -_current_cancel - _current_retails -_previous_cancel_month - _previous_retails_month)
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous Hi, I still have not found a way out for these issues. As your solution, we have 2 weeks 40, and the result is not the same for them. How to combine them?