The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Claim_Number | Policy_Eff_Date | Transaction_Date | Total_Incurred |
CPZ2500359 | 1/5/2025 | 2/19/2025 | 95000 |
CPZ2500359 | 1/5/2025 | 3/7/2025 | 0 |
CPZ2500359 | 1/5/2025 | 3/7/2025 | 0 |
CPZ2500359 | 1/5/2025 | 3/7/2025 | 0 |
CPZ2500359 | 1/5/2025 | 3/6/2025 | 3500 |
CPZ2500359 | 1/5/2025 | 4/24/2025 | 0 |
CPZ2500359 | 1/5/2025 | 4/23/2025 | -1549.900024 |
CPZ2500359 | 1/5/2025 | 4/23/2025 | 1549.900024 |
CPZ2500359 | 1/5/2025 | 4/23/2025 | 40000 |
CPZ2500359 | 1/5/2025 | 4/23/2025 | 1416250 |
CPZ2500359 | 1/5/2025 | 4/23/2025 | 605700 |
CPZ2500359 | 1/5/2025 | 4/23/2025 | 730000 |
CPZ2500359 | 1/5/2025 | 5/5/2025 | 0 |
CPZ2500359 | 1/5/2025 | 5/20/2025 | 0 |
CPZ2500359 | 1/5/2025 | 5/23/2025 | 0 |
CPZ2500437 | 2/20/2025 | 3/31/2025 | 2500 |
CPZ2500437 | 2/20/2025 | 3/31/2025 | 10000 |
CPZ2500437 | 2/20/2025 | 4/25/2025 | 165000 |
CPZ2500437 | 2/20/2025 | 5/19/2025 | 0 |
CPZ2400239 | 1/16/2024 | 11/15/2024 | 20000 |
CPZ2400239 | 1/16/2024 | 11/15/2024 | 25000 |
CPZ2400239 | 1/16/2024 | 2/4/2025 | 0 |
CPZ2400239 | 1/16/2024 | 2/3/2025 | 25000 |
CPZ2400239 | 1/16/2024 | 4/30/2025 | 70000 |
CPZ2400239 | 1/16/2024 | 5/5/2025 | 0 |
CPZ2500360 | 1/20/2025 | 2/24/2025 | 17500 |
CPZ2500360 | 1/20/2025 | 3/21/2025 | 80000 |
CPZ2500360 | 1/20/2025 | 1/30/2025 | 3057.7 |
Policy Year/Month | Total Incurred |
2024 | 140000 |
January | 140000 |
2025 | 2278058 |
January | 2100558 |
February | 177500 |
Policy Year/Month | Total Incurred |
2024 | 70000 |
January | 70000 |
2025 | 112500 |
January | 112500 |
February | 0 |
Solved! Go to Solution.
@MarkLaf Thank you for the suggestion but I believe I found my DAX query that will give me the result I need:
Hi @bijaymaharjan,
Thank you for reaching out to the Microsoft fabric community forum. Also thanks @MarkLaf, @SamsonTruong, for those insights on this thread. I reproduced the scenario, and it worked on my end. I used my sample data and successfully implemented it.
outcome:
I am also including .pbix file for your better understanding, please have a look into it:
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @v-kpoloju-msft ,
Thank you for looking in the problem and providing a solution for it but this is not correct. The Total_Incurred value you are showing in the matrix is total based on the Transaction date and not the Policy Effective Date. The date in the matrix should represent the Policy Year and the Total Incurred should be the total of the policy effective date. For example, if we set the filter to be from 11/15/2024 to 3/31/2025, then the table should filter to show all the data that has a transaction date between 11/15/2024 to 3/31/2025 and then the total should be done based on the Policy Effective date. I have included a detail example explanation in my requirements above. I hope you can help me out on this.
Hi @bijaymaharjan,
Apologize for the inconvenience caused.I reproduced the scenario again, and it worked on my end. I used my sample data and successfully implemented it.
outcome:
I am also including .pbix file for your better understanding, please have a look into it:
If you have any questions regarding this, please feel free to reach out to us. We will be happy to help you. If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @v-kpoloju-msft , this is not correct. The Total Incurred numbers should be based on Policy Year and not the Transaction Year. The matrix shows that April has 2M numbers but there is no policy in the sample that has policy effective date of April.
Hi @bijaymaharjan,
I reproduced the scenario again, and it worked on my end. I used my sample data and successfully implemented it. Used line chart.
outcome:
I am also including .pbix file for your better understanding, please have a look into it:
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
Hi @bijaymaharjan,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @bijaymaharjan,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @bijaymaharjan,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @SamsonTruong
Thank you for the answer. Your query worked on getting the result but when I change the data in the filter the matrix does not get updated with the correct numbers. I have re-edited my original request with more clear examples and the desired result. Could you please go over the example description again and the update your query?
If you are concerned about subtotals, then you'll want an iterator version:
Incurred_Capped2M =
CALCULATE(
SUMX(
VALUES( 'Table'[Claim_Number] ),
MIN( CALCULATE( SUM( 'Table'[Total_Incurred] ) ), 2000000 )
),
Dates[Date] <= MAX( Dates[Date] )
)
If subtotals don't need to add up correctly (or if you want subtotals to also be capped at 2M):
Incurred_Capped2M_BadSubtotals =
CALCULATE(
MIN( CALCULATE( SUM( 'Table'[Total_Incurred] ) ), 2000000 ),
Dates[Date] <= MAX( Dates[Date] )
)
In action (dates slicer is just showing end of month dates):
Hi @MarkLaf ,
Thank you for looking at my question. The 2M cap does not apply to sub-total and grand-total, only to the individual claims total. I edited by original request with more detailed example and what I am looking for as a result. Could you please look at it again and revise your query to help me find the solution?
Tldr, you need to introduce a separate Dates table (or add Policy Year/Month columns to Claims table to use in matrix) so the slicer selection does not interfere with your matrix rows.
The challenge is that, when you have Dates[Date] filtering Claims[Policy_Eff_Date], the intersection of the filter context from visual and filter context from slicer will give you undesired results.
Something like the below almost gets what you want:
Transaction Grouped By Policy =
VAR _selectDate = CALCULATE( MAX( Dates[Date] ), ALLSELECTED( Dates ) ) RETURN
CALCULATE(
SUMX(
VALUES( Claims[Claim_Number] ),
MIN( 2000000,
CALCULATE(
SUM( Claims[Total_Incurred] ),
REMOVEFILTERS( Dates ),
Claims[Transaction_Date] <= _selectDate
)
)
),
USERELATIONSHIP( Claims[Policy_Eff_Date], Dates[Date] )
)
You get what you want when nothing is selected in slicer:
You can see the problem more practically, though, if you think through the filter context at the highlight when you have '2/28/2025' selected in the slicer.
The filter is the following, on either Claims[Transaction_Date] or Claims[Policy_Eff_Date]:
The problem isn't our internal sum calculate, as we tell it to ignore all the filters on Dates (REMOVEFILTERS) and just use our new Claims[Transaction_Date] <= _selectDate filter.
The issue is that there is no way to say to the iterator (VALUES( Claims[Claim_Number] ) where Dates[Date] filters Claims[Policy_Eff_Date]) that we want to keep filters from the visual but ignore filters from the slicer (something like the inverse of what ALLSELECTED does). So, our slicer selection will result in a blank visual (there are no policy dates on 2/28/2025).
To fix this, we need another Dates table, disconnected from the rest of the model. Calling it Dates_Select.
Dates_Select = Dates
Then, our measure can work if we switch out the filter on the inner sum. And since Dates_Select is disconnected from Claims, making selections won't impact our matrix rows.
Transaction Grouped By Policy_fixed =
VAR _selectDate = MAX( Dates_Select[Date] ) RETURN
CALCULATE(
SUMX(
VALUES( Claims[Claim_Number] ),
MIN( 2000000,
CALCULATE(
SUM( Claims[Total_Incurred] ),
REMOVEFILTERS( Dates ),
Claims[Transaction_Date] <= _selectDate
)
)
),
USERELATIONSHIP( Claims[Policy_Eff_Date], Dates[Date] )
)
@MarkLaf Thank you for the suggestion but I believe I found my DAX query that will give me the result I need:
Hi @bijaymaharjan ,
Please try using the following DAX measure and let me know if it achieves your desired result:
Total Loss:=
CALCULATE (
SUMX (
ADDCOLUMNS(
VALUES(Claims[Claim_Number]),
"ClaimLoss",
MIN(2000000,
CALCULATE(
SUM(Claims[Total_Incurred]),
ALLEXCEPT (Claims, Claims[Claim_Number])
)
)
),
[ClaimLoss]
),
USERELATIONSHIP(Claims[Policy_Eff_Date], 'Date'[Date])
)
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson
Connect with me on LinkedIn
Check out my Blog
Going to the European Microsoft Fabric Community Conference? Check out my Session
User | Count |
---|---|
14 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |