Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Measure to sum values from 2 different columns considering different status

Hello Guys,

 

I need to create a measure to sum values from 2 different columns considering the specific status.

 

What I need is: if the "Status Column" is filled with 'Indemnified' I need to consider in the sum the values from the column "Payed Value", but if the "Status Column" is filled with 'Pending', I need to consider in the sum the values from the column "Estimated Loss".

 

For example:

Date of the claimCauseEstimated LossPayed ValueStatus
2020-03-22Electrical Damage $              500,00 $         375,00Indemnified
2020-03-25Robery $          1.500,00 $         750,00Indemnified
2020-05-04Fire $              250,00 $         225,00Indemnified
2020-05-10Fire $          7.500,00 $     7.500,00Indemnified
2020-10-21Fire $              345,00 $         345,00Indemnified
2020-11-13Robery $          4.330,000Pending
2020-12-25Explosion $          1.200,000Pending
2020-12-25Electrical Damage $              450,00 $         337,50Indemnified
2021-01-01Electrical Damage $          3.400,000Pending

 

Thank you,

2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

Hi @Anonymous 

You need to be more specific. What is the expected result for the data  above?

Try

Measure =
SUMX (
    Table1,
    IF (
        Table1[Status] = "Indemnified",
        Table1[PaidValue],
        IF ( Table1[Status] = "Pending", Table1[EstimatedLoss] )
    )
)

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

In general, it's better to use filters than IFs inside of an iterator. So I'd suggest an alternative:

 

NewMeasure =
CALCULATE (
    SUM ( Table1[Payed Value] ),
    FILTER ( Table1, Table1[Status] = "Indemnified" )
) +
CALCULATE (
   SUM ( Table1[Estimated Loss] ),
   FILTER ( Table1, Table1[Status] = "Pending" )
)

 

View solution in original post

5 REPLIES 5
AlB
Community Champion
Community Champion

Hi @Anonymous 

You need to be more specific. What is the expected result for the data  above?

Try

Measure =
SUMX (
    Table1,
    IF (
        Table1[Status] = "Indemnified",
        Table1[PaidValue],
        IF ( Table1[Status] = "Pending", Table1[EstimatedLoss] )
    )
)

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Anonymous
Not applicable

The result of this sum it will represent my "loss ratio" with the insurer, what means that is possible I will face an increase in the renewal cost of this insurance.

 

Thank you so much,

Your suggestion worked very well !!!

In general, it's better to use filters than IFs inside of an iterator. So I'd suggest an alternative:

 

NewMeasure =
CALCULATE (
    SUM ( Table1[Payed Value] ),
    FILTER ( Table1, Table1[Status] = "Indemnified" )
) +
CALCULATE (
   SUM ( Table1[Estimated Loss] ),
   FILTER ( Table1, Table1[Status] = "Pending" )
)

 

AlB
Community Champion
Community Champion

@AlexisOlson 

True.  IFs within an iterator are usually a drag on performance.

It is also better to filter only on columns rather than on the full table:

NewMeasure V2 =
CALCULATE ( SUM ( Table1[Payed Value] ), Table1[Status] = "Indemnified" )
    + CALCULATE ( SUM ( Table1[Estimated Loss] ), Table1[Status] = "Pending" )

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Anonymous
Not applicable

Thank you so much,

Your suggestion worked very well !!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.