Forum Discussion
Gauravi
4 years agoNew Member
DAX Calculation
The following is my data model: 1. Contracts table with the following fields – ContractId, SalesRepId, CreatedDate, ContractAmount, CancelledDate 2. Date table with basic date fields – date, mont...
- 4 years ago
Hi Gauravi ,
Try this:
Measure = VAR SelectedDate_ = VALUES ( 'Date'[Date] ) VAR SamePeriodLastYear_ = CALCULATETABLE ( VALUES ( 'Date'[Date] ), SAMEPERIODLASTYEAR ( 'Date'[Date] ) ) RETURN CALCULATE ( SUM ( Contracts[ContractAmount] ), ALL ( 'Date' ), Contracts[CreatedDate] IN SamePeriodLastYear_, Contracts[CancelledDate] IN SelectedDate_ )For more details, please check the attached .pbix file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Icey
4 years agoCommunity Support
Hi Gauravi ,
Try this:
Measure =
VAR SelectedDate_ =
VALUES ( 'Date'[Date] )
VAR SamePeriodLastYear_ =
CALCULATETABLE ( VALUES ( 'Date'[Date] ), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
RETURN
CALCULATE (
SUM ( Contracts[ContractAmount] ),
ALL ( 'Date' ),
Contracts[CreatedDate] IN SamePeriodLastYear_,
Contracts[CancelledDate] IN SelectedDate_
)
For more details, please check the attached .pbix file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.