Forum Discussion
table with more than one date column
- Anonymous2 years ago
Hi miinseon ,
Your solution is great, bhanu_gautam . Here I have another idea in mind, and I would like to share it for reference.
As per your question, I have created simple data :
Since you need to get the amount paid one day after the reserve date, we use the following function:
Measure 2 = VAR _date = SELECTEDVALUE('DAX DateTable'[Date]) + 1 VAR _sum = CALCULATE(SUM('Table'[price]),FILTER(ALL('Table'),'Table'[payment_date] = _date && 'Table'[reserve_date] = SELECTEDVALUE('DAX DateTable'[Date]))) RETURN _sumThe final results are as follows:
If you have any other questions please feel free to contact me.
Best Regards,
Zhu
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
miinseon - To build on the idea from bhanu_gautam you can also do this with one date table.
Create base measures:
CountBookings = COUNTROWS('Bookings')
TotalAmount = SUM('Bookings'[AmountPaid])
Then create measures that reference these, but change the context of their calculation by date:
CountBookingsByReserveDate = CALCULATE( [CountBookings], USERELATIONSHIP( 'Bookings'[Reserve Date], 'Calendar_table'[Date]))
TotalAmountPaidByReserveDate = CALCULATE( [TotalAmountPaid], USERELATIONSHIP( 'Bookings'[Reserve Date], 'Calendar_table'[Date]))
CountBookingsByPaymentDate = CALCULATE( [CountBookings], USERELATIONSHIP( 'Bookings'[Payment Date], 'Calendar_table'[Date]))
TotalAmountPaidByPaymentDate = CALCULATE( [TotalAmountPaid], USERELATIONSHIP( 'Bookings'[Payment Date], 'Calendar_table'[Date]))
Finally these measures will only work once you have created 2 "In-active" relationships from the Calendar table to the respective dates in the Bookings table. Very important to make sure they are both In-active.
If this works for you, please mark as the solution.