Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have found the issue with my report, but am unable to fix the formula to work. Please see the formula below. The data in my BI goes back to 2019, but the actual data goes back much further. If the date is set to 2024 only, the End Net Exposure should only return 0 if there is a Pol with the matching PolicyNumber. However, the End is returning 0 if there is a Pol with a matching PolicyNumber anywhere from 2019-2025. The only End's that are not getting turned into 0 is if the Pol is prior to 2019. The date slicer is 'FactPolicyEndorsement'[DateReceived]. Any ideas?
Effective Net Exposure =
VAR CurrentPolicyNumber = 'FactPolicyEndorsement'[PolicyNumber] // Current policy number
VAR CurrentRecordType = 'FactPolicyEndorsement'[RecordType] // Current record type
VAR CurrentReceivedDate = 'FactPolicyEndorsement'[ReceivedDate] // Current received date
VAR PolNetExposure = 'FactPolicyEndorsement'[NetExposure] // Net exposure for the policy
VAR MinDate = CALCULATE(MIN('FactPolicyEndorsement'[ReceivedDate]), ALLSELECTED('FactPolicyEndorsement')) // Minimum received date within the selected context
VAR MaxDate = CALCULATE(MAX('FactPolicyEndorsement'[ReceivedDate]), ALLSELECTED('FactPolicyEndorsement')) // Maximum received date within the selected context
VAR EndNetExposure_WithinRange =
CALCULATE(
SUM('FactPolicyEndorsement'[NetExposure]),
FILTER(
'FactPolicyEndorsement',
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "End" &&
'FactPolicyEndorsement'[ReceivedDate] >= MinDate &&
'FactPolicyEndorsement'[ReceivedDate] <= MaxDate
)
) // Sum of net exposure for endorsements within the date range
VAR EndNetExposure_OutsideRange =
CALCULATE(
SUM('FactPolicyEndorsement'[NetExposure]),
FILTER(
'FactPolicyEndorsement',
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "End" &&
('FactPolicyEndorsement'[ReceivedDate] < MinDate || 'FactPolicyEndorsement'[ReceivedDate] > MaxDate)
)
) // Sum of net exposure for endorsements outside the date range
RETURN
IF(
CurrentRecordType = "Pol",
PolNetExposure + EndNetExposure_WithinRange, // Sum of policy net exposure and endorsements within the range if record type is "Pol"
IF(
CurrentRecordType = "End" &&
CALCULATE(
COUNTROWS('FactPolicyEndorsement'),
FILTER(
'FactPolicyEndorsement',
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "Pol" &&
'FactPolicyEndorsement'[ReceivedDate] >= MinDate &&
'FactPolicyEndorsement'[ReceivedDate] <= MaxDate
)
) > 0,
0, // Returns 0 if record type is "End" and there are "Pol" records within the date range
'FactPolicyEndorsement'[NetExposure] // Otherwise, returns net exposure for the current record
)
)
Solved! Go to Solution.
Thank you for your help, but the formula does not work. I will paste below the formula I think is close. The issue with this formula is it makes all End 0 if there is a matching Pol from 2019-2025 (my entire dataset). The only End's that are not turned to 0 are those that have a matching Pol from 2018 or earlier, which isn't in my dataset. Even if I set the date slicer to 2024-2025, all End's are still turned to 0 even if the matching Pol is in 2023.
Are you creating a measure or a calculated column. I'm a little bit confused as in the formula you are referencing columns such as 'FactPolicyEndorsement'[PolicyNumber] without specifying any kind of aggregation. Or are these in fact measures?
I am creating a calculated column. All the others are columns.
Hi @kellanbochenek,
Thank you for your continued clarification, and I understand the issue more clearly now. The error you're encountering is due to the format of the ReceivedDate field, as it contains a full date (MM/DD/YYYY), not just the year. To resolve this and ensure the formula handles multiple years dynamically, we'll need to make sure we correctly extract the year from the ReceivedDate field.
Here’s a refined version of the formula that addresses both the date format issue and ensures that the End records are correctly zeroed out when there is a matching Pol within the selected date range. It will also preserve the dynamic handling of multiple years from the slicer:
Effective Net Exposure =
VAR CurrentPolicyNumber = 'FactPolicyEndorsement'[PolicyNumber]
VAR CurrentRecordType = 'FactPolicyEndorsement'[RecordType]
VAR CurrentReceivedDate = 'FactPolicyEndorsement'[ReceivedDate]
VAR PolNetExposure = 'FactPolicyEndorsement'[NetExposure]
VAR SelectedYears =
VALUES(YEAR('FactPolicyEndorsement'[ReceivedDate])) // Extract the Year from the full ReceivedDate
VAR EndNetExposure_SameYear =
CALCULATE(
SUM('FactPolicyEndorsement'[NetExposure]),
FILTER(
ALL('FactPolicyEndorsement'),
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "End" &&
YEAR('FactPolicyEndorsement'[ReceivedDate]) IN SelectedYears
)
)
VAR HasPolInSelectedYears =
CALCULATE(
COUNTROWS('FactPolicyEndorsement'),
FILTER(
ALL('FactPolicyEndorsement'),
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "Pol" &&
YEAR('FactPolicyEndorsement'[ReceivedDate]) IN SelectedYears
)
)
RETURN
IF(
CurrentRecordType = "Pol",
PolNetExposure + EndNetExposure_SameYear,
IF(
CurrentRecordType = "End" && HasPolInSelectedYears > 0,
0, // Zero out 'End' if a matching 'Pol' exists within the selected years
'FactPolicyEndorsement'[NetExposure] // Otherwise, retain the NetExposure
)
)
The formula has been updated to properly handle the ReceivedDate by extracting the year using the YEAR() function, ensuring it works with the slicer and supports dynamic filtering across multiple years. The SelectedYears variable now correctly stores the selected years from the slicer, so the formula adapts based on those settings. Additionally, the matching logic for "Pol" and "End" records has been adjusted to ensure that "End" records are only zeroed out if there is a corresponding "Pol" within the selected date range.
Please update your report with this revised formula and test it again with different date slicer settings. The solution should now correctly zero out "End" records when there’s a matching "Pol" within the selected range and retain the correct NetExposure for other cases. If you face any further issues, feel free to reach out.
Please Accept as solution if this meets your needs and a Kudos would be appreciated.
Thank you.
Hi @kellanbochenek,
we haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.
If our response addressed by the community member for your query, please mark it as Accept Answer and give us Kudos. Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!
Thank you for your help, but the formula does not work. I will paste below the formula I think is close. The issue with this formula is it makes all End 0 if there is a matching Pol from 2019-2025 (my entire dataset). The only End's that are not turned to 0 are those that have a matching Pol from 2018 or earlier, which isn't in my dataset. Even if I set the date slicer to 2024-2025, all End's are still turned to 0 even if the matching Pol is in 2023.
Hi @kellanbochenek,
Thank you for sharing the formula and the detailed explanation of the issue. Based on your description, it seems that the behavior you're experiencing is not as expected, and it may require further investigation to identify the root cause. To ensure timely resolution and expert assistance, I recommend raising a support ticket to ensure we get the necessary assistance and resolution.
Looking forward to your confirmation.
Thank you.
HI @kellanbochenek,
Could you please confirm if the issue has been resolved after raising a support case? If a solution has been found, it would be greatly appreciated if you could share your insights with the community. This would be helpful for other members who may encounter similar issues.
Thank you for your understanding and assistance.
Hi @kellanbochenek,
We are following up once again regarding your query. Could you please confirm if the issue has been resolved through the support ticket with Microsoft?
If the issue has been resolved, we kindly request you to share the resolution or key insights here to help others in the community. If we don’t hear back, we’ll go ahead and close this thread.
Should you need further assistance in the future, we encourage you to reach out via the Microsoft Fabric Community Forum and create a new thread. We’ll be happy to help.
Thank you for your understanding and participation.
Hi @kellanbochenek,
Thanks for your clarification, the issue makes complete sense now. Your original version worked because it compared “Pol” and “End” records strictly within the same year, using YEAR() logic. However, the attempt to make this dynamic with ALLSELECTED() introduced a filtering problem: it was unintentionally considering records from outside the slicer range due to poor filter isolation.
To fix this and keep it dynamic across multiple years, here’s a new version of your measure that preserves the same year matching logic but dynamically adapts to the slicer’s selected years. Try using this Measure:
Effective Net Exposure =
VAR CurrentPolicyNumber = 'FactPolicyEndorsement'[PolicyNumber]
VAR CurrentRecordType = 'FactPolicyEndorsement'[RecordType]
VAR CurrentReceivedDate = 'FactPolicyEndorsement'[ReceivedDate]
VAR PolNetExposure = 'FactPolicyEndorsement'[NetExposure]
VAR SelectedYears =
VALUES('FactPolicyEndorsement'[ReceivedDate].[Year]) // Get selected years from slicer
VAR EndNetExposure_SameYear =
CALCULATE(
SUM('FactPolicyEndorsement'[NetExposure]),
FILTER(
ALL('FactPolicyEndorsement'),
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "End" &&
YEAR('FactPolicyEndorsement'[ReceivedDate]) IN SelectedYears
)
)
VAR HasPolInSelectedYears =
CALCULATE(
COUNTROWS('FactPolicyEndorsement'),
FILTER(
ALL('FactPolicyEndorsement'),
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "Pol" &&
YEAR('FactPolicyEndorsement'[ReceivedDate]) IN SelectedYears
)
)
RETURN
IF(
CurrentRecordType = "Pol",
PolNetExposure + EndNetExposure_SameYear,
IF(
CurrentRecordType = "End" && HasPolInSelectedYears > 0,
0,
'FactPolicyEndorsement'[NetExposure]
)
)
This version makes sure that only the 'End' rows with matching 'Pol' values in the selected year(s) are made zero. It fixes the issue for multiple years without using any hardcoding.
If my response was helpful, consider clicking "Accept as Solution" and give us "Kudos" so that other community members can find it easily. Let me know if you need any more assistance!
Thank you.
VALUES('FactPolicyEndorsement'[ReceivedDate].[Year]) // Get selected years from slicer. This line resulted in an error as ReceivedDate is formatted as MM/DD/YYYY. Please reference below the adjusted formula I attempted that you provided. This formula did not turn all "End"s into 0, so that part worked. However, it did not group the "Pol" and "End" correctly as this formula did not turn any "End" into 0, even if it had a matching "Pol" within the date slicer range. Any ideas? Thanks.
Hi @kellanbochenek,
Thank you for your patience.
The workaround provided by @DataNinja777 correctly addresses the issue you raised.
Specifically, the solution properly isolates the slicer's date context to avoid incorrect filtering, ensures "End" records return 0 only if a "Pol" record exists within the selected date range and correctly retains the Net Exposure for "End" records when no corresponding "Pol" exists in the range.
Kindly implement the suggested changes in your report. This should resolve the unexpected behavior you were encountering with the Date Slicer filtering.
I hope this helped! Feel free to ask any further questions. If this resolved your issue, please mark it as "Accept as Solution" and give us Kudos to assist others.
Thank you for using Microsoft Fabric Community Forum.
Hi @kellanbochenek ,
You're working with a DAX formula that calculates Effective Net Exposure based on two record types in your dataset: "Pol" (policy issuance) and "End" (endorsements). Your model includes a slicer filtering 'FactPolicyEndorsement'[ReceivedDate] — let’s say it's set to only show data for the year 2024.
The logic you want is:
Sounds simple enough — but the issue is that the current measure incorrectly zeroes out "End" exposures when there’s any matching "Pol" record in the dataset, even if it’s outside the selected date range. In your case, it’s returning 0 for "End" rows in 2024 just because there’s a "Pol" for that policy from 2019 still hanging around.
The root cause? Your original CALCULATE logic is checking for a "Pol" match in a way that inherits unwanted filter context from the report. Specifically, your formula didn’t fully isolate the slicer’s date context, so it was evaluating the condition over the entire table (from 2019 to 2025).
The fix? You need to remove all filters from the table, then reapply only the filters you care about: same PolicyNumber, RecordType = "Pol", and the received date falling within the selected range.
Here is the fully rewritten, clean, copy-pasteable DAX measure that will behave correctly:
Effective Net Exposure =
VAR CurrentPolicyNumber = 'FactPolicyEndorsement'[PolicyNumber]
VAR CurrentRecordType = 'FactPolicyEndorsement'[RecordType]
VAR PolNetExposure = 'FactPolicyEndorsement'[NetExposure]
VAR MinDate = CALCULATE(MIN('FactPolicyEndorsement'[ReceivedDate]), ALLSELECTED('FactPolicyEndorsement'))
VAR MaxDate = CALCULATE(MAX('FactPolicyEndorsement'[ReceivedDate]), ALLSELECTED('FactPolicyEndorsement'))
VAR EndNetExposure_WithinRange =
CALCULATE(
SUM('FactPolicyEndorsement'[NetExposure]),
FILTER(
'FactPolicyEndorsement',
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "End" &&
'FactPolicyEndorsement'[ReceivedDate] >= MinDate &&
'FactPolicyEndorsement'[ReceivedDate] <= MaxDate
)
)
VAR HasPolInDateRange =
CALCULATE(
COUNTROWS('FactPolicyEndorsement'),
REMOVEFILTERS('FactPolicyEndorsement'),
FILTER(
'FactPolicyEndorsement',
'FactPolicyEndorsement'[PolicyNumber] = CurrentPolicyNumber &&
'FactPolicyEndorsement'[RecordType] = "Pol" &&
'FactPolicyEndorsement'[ReceivedDate] >= MinDate &&
'FactPolicyEndorsement'[ReceivedDate] <= MaxDate
)
)
RETURN
IF(
CurrentRecordType = "Pol",
PolNetExposure + EndNetExposure_WithinRange,
IF(
CurrentRecordType = "End" && HasPolInDateRange > 0,
0,
'FactPolicyEndorsement'[NetExposure]
)
)
This version uses REMOVEFILTERS to make sure you're not unintentionally applying filters from other visuals or fields that might mess with your logic. The measure strictly follows the behavior you want based on the slicer’s date range and the relationship between "Pol" and "End" records.
Let me know if you want to add even more precision — like ignoring future dates, treating overlapping policies differently, or warning if no "Pol" exists at all.
Best regards,
Hello, thank you for your reply and help. Unfortunately, the same issue occurred where if an "End" had a matching "Pol" anywhere from 2019-2025, it was turned to 0 regardless of what the slicer was set to. The only "Ends" not turned to zero were those that had a matching "Pol" prior to 2019. Please see below for my original code that works correctly, but the date is not dynamic and only works within one year. I am not sure if this will help, but the code worked prior to trying to make it dynamic so it would work over multiple years.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
11 | |
11 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |