Reputation: 3
I am trying to have a user in Power BI select a date. Then I want my visual to sum all insurance policies' premium with an effective date ON or BEFORE that selected date AND an expiration date AFTER that selected date. This will show all policies currently in force. How can I do this?
In my head it sounds like an IF statement sorta like:
IF Policy[EffectiveDate] <= Calendar[Date] AND Policy[ExpirationDate] > Calendar[Date] Return [Current Year Premium]
I have no idea how to write this so it works though.
Upvotes: 0
Views: 80
Reputation: 4346
Try using a measure like this
Measure =
VAR _selectedDate =
MAX ( 'Calendar'[Date] )
RETURN
CALCULATE (
SUM ( Policy[Premium] ),
FILTER (
Policy,
Policy[EffectiveDate] <= _selectedDate
&& Policy[ExpirationDate] > _selectedDate
)
)
Upvotes: 0