Forum Discussion
Custom Column Only Works for Full Year
- Anonymous1 year ago
Hi kellanbochenek
It seems that the issue may stem from how 'Effective_Net_Exposure' handles dates when policies span multiple years. Since 2023 is correct, but 2024 has discrepancies, it could be due to how "Pol" and "End" records from prior years are factored into your current year logic. Here are some adjustments you can try:- Ensure that the "Pol" record you’re summing 'EndNetExposure' with is indeed from the current year. You could add a filter to check that "Pol" records are only added if they’re within the current year.
- Ensure that the "Pol" record you’re summing 'EndNetExposure' with is indeed from the current year. You could add a filter to check that "Pol" records are only added if they’re within the current year.
Updated Dax:
Effective_Net_Exposure = VAR CurrentPolicyNumber = 'FactPolicyEndorsement'[PolicyNumber] VAR CurrentRecordType = 'FactPolicyEndorsement'[RecordType] VAR CurrentReceivedDate = 'FactPolicyEndorsement'[ReceivedDate] VAR CurrentYear = YEAR(CurrentReceivedDate) VAR PolNetExposure = 'FactPolicyEndorsement'[NetExposure] VAR EndNetExposure_SameYear = CALCULATE( SUM('FactPolicyEndorsement'[NetExposure]), FILTER( 'FactPolicyEndorsement', 'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber && 'FactPolicyEndorsement'[RecordType] = "End" && YEAR('FactPolicyEndorsement'[ReceivedDate]) = CurrentYear ) ) VAR EndNetExposure_DiffYear = CALCULATE( SUM('FactPolicyEndorsement'[NetExposure]), FILTER( 'FactPolicyEndorsement', 'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber && 'FactPolicyEndorsement'[RecordType] = "End" && YEAR('FactPolicyEndorsement'[ReceivedDate]) <> CurrentYear ) ) RETURN IF( CurrentRecordType = "Pol", PolNetExposure + EndNetExposure_SameYear, IF( CurrentRecordType = "End" && CALCULATE( COUNTROWS('FactPolicyEndorsement'), FILTER( 'FactPolicyEndorsement', 'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber && 'FactPolicyEndorsement'[RecordType] = "Pol" && YEAR('FactPolicyEndorsement'[ReceivedDate]) = CurrentYear ) ) > 0, 0, 'FactPolicyEndorsement'[NetExposure] ) )Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Ensure that the "Pol" record you’re summing 'EndNetExposure' with is indeed from the current year. You could add a filter to check that "Pol" records are only added if they’re within the current year.
That DAX seems incorrect. Where does x come from?
- kellanbochenek1 year ago
Helper I
x is just a placeholder for different $ values and I am trying to put them in those different buckets.
- lbendlin1 year ago
Super User
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523