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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Nico_89
New Member

How to Sum and accurately summarize when conditions are in place

Hello Everyone, 

 

I am trying to have a Sum calculation based on several columns per row, there is an identifier that indicates that 3 columns should be included in the sum, and for any others only 2 columns. 

 

The issue I am having is that the row level calculation is correct and works perfectly, but when grouping by customers the identifier gets ignored, and the total sum aggregates the 2-column formula when in reality there is an internal item that has the "True" identifier. 

Nico_89_0-1688744593753.png

The second row on the example above shows the calculation when the identifier is "True", and yet the total amount does not show the actual sum of the 2 rows that are part of the customer revenue total. 

 

Perhaps using summarize will solve the issue but I don't understand how the syntax will work on my case.

 

I have tried different measures and all end up the same, see them below

Revenue =

    IF(
        SELECTEDVALUE('Carriers'[FRS_Product]) = TRUE,
           CALCULATE(
                SUM('Master Accounts Bound'[Renewal Net House Commission])
                + SUM('Master Accounts Bound'[Agency Fees.amount])
                + SUM('Master Accounts Bound'[Policy Fee])
           )
        ,
            CALCULATE(
                SUM('Master Accounts Bound'[Renewal Net House Commission])
                + SUM('Master Accounts Bound'[Agency Fees.amount])
            )
    )

---------------------------------------------------------------------------------------------------------------------------

Revenue X =
    SUMX('Master Accounts Bound',
        IF(
        SELECTEDVALUE('Carriers'[FRS_Product]) = TRUE,
         
            'Master Accounts Bound'[Renewal Net House Commission]
            + 'Master Accounts Bound'[Agency Fees.amount]
            + 'Master Accounts Bound'[Policy Fee]
        ,
            'Master Accounts Bound'[Renewal Net House Commission]
            + 'Master Accounts Bound'[Agency Fees.amount]
        )
             
       
    )

-------------------------------------------------------------------------------------------------------------------

 

1 ACCEPTED SOLUTION

@Nico_89 

Not sure Customer from which table but could be something like 

Revenue X =
SUMX (
CROSSJOIN (
VALUES ( 'Master Accounts Bound'[Customer] ),
VALUES ( 'Carriers'[FRS_Product] )
),
VAR FRSProduct = 'Carriers'[FRS_Product]
RETURN
SUMX (
CALCULATETABLE ( 'Master Accounts Bound' ),
IF (
'Carriers'[FRS_Product] = TRUE,
'Master Accounts Bound'[Renewal Net House Commission] + 'Master Accounts Bound'[Agency Fees.amount] + 'Master Accounts Bound'[Policy Fee],
'Master Accounts Bound'[Renewal Net House Commission] + 'Master Accounts Bound'[Agency Fees.amount]
)
)
)

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @Nico_89 

please try

Revenue X =
SUMX (
CROSSJOIN ( 'Master Accounts Bound', VALUES ( 'Carriers'[FRS_Product] ) ),
IF (
'Carriers'[FRS_Product] = TRUE,
'Master Accounts Bound'[Renewal Net House Commission] + 'Master Accounts Bound'[Agency Fees.amount] + 'Master Accounts Bound'[Policy Fee],
'Master Accounts Bound'[Renewal Net House Commission] + 'Master Accounts Bound'[Agency Fees.amount]
)
)

Hi, 

 

Thanks for your reply but no, it's actually worse

Nico_89_0-1688748135224.png

 

@Nico_89 

What else do tou have in the table? Or in other words what are you slicing by in the table visual?

I am slicing by Customer, different products have different revenue calculations based on the FRS identifier, and in the case shown on the screenshot, the customer acquired 2 products, the revenue on one is calculated based on 2 columns and the other based on 3 columns. But the summary of the 2 products shows the result as if both products have False for the identifier and calculating revenue based on 2 columns for both. 


Data looks sort like this 

Nico_89_0-1688750974137.png

Rules for the Revenue are as follows

Nico_89_1-1688751022348.png

 

 

@Nico_89 

Not sure Customer from which table but could be something like 

Revenue X =
SUMX (
CROSSJOIN (
VALUES ( 'Master Accounts Bound'[Customer] ),
VALUES ( 'Carriers'[FRS_Product] )
),
VAR FRSProduct = 'Carriers'[FRS_Product]
RETURN
SUMX (
CALCULATETABLE ( 'Master Accounts Bound' ),
IF (
'Carriers'[FRS_Product] = TRUE,
'Master Accounts Bound'[Renewal Net House Commission] + 'Master Accounts Bound'[Agency Fees.amount] + 'Master Accounts Bound'[Policy Fee],
'Master Accounts Bound'[Renewal Net House Commission] + 'Master Accounts Bound'[Agency Fees.amount]
)
)
)

This one worked pretty well, thank you very much!

 

I will need to review the formula and see how it works as I have no clue how it works, but heck it works! 😁

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.