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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
MarkEden
Frequent Visitor

Variations affecting all rows in table

Hi All,

 

I'm new to PowerBI & DAX and am struggling with creating a variation on a comparison of insurance products premiums for last 12 months agains prior 12 months. I've managed to create the LTM and PTM measures and this works for the insurer selected in a page slicer. The issue I have is that when certain insurers are selected I need to add back premiums for some products from a different insurer. Something like:

 

If insurer A is selected then show LTM and PTM allocated to A

If Insurer B is selected then show LTM and PTM allocated to B plus LTM and PTM for A but only for products 1 and 2

 

I'm trying to do this with measures to calculate the individual amounts and then with a SWITCH( TRUE(), measure. This works for the total, but it also adds to each row throwing those figures out. I'd appreciate if anyone can help me find a way to add only to the relevent product rows.

Here are my SWITCH( TRUE() formula and the table

 

Total including variations = 
SWITCH( TRUE(),
[Selected Insurer] = "Insurer A", [Total Premium] + [Insurer C Accident & Health Premium] + [Insurer C Professional Risks Premium],
[Selected Insurer] = "Insurer B", [Total Premium] + [Insurer C Marine Premium],
[Total Premium)

 

MarkEden_0-1654682248131.png

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @MarkEden ,

According to your description, in my understanding, you want for example for Insurer B, only when the Risk Class row is Marine, it should be "[Total Premium] + [Insurer C Marine Premium]", otherwise, it should be "[Total Premium]".

If this is the case, here's my solution.

Total including variations =
SWITCH (
    TRUE (),
    [Selected Insurer] = "Insurer A",
        [Total Premium] + [Insurer C Accident & Health Premium] + [Insurer C Professional Risks Premium],
    [Selected Insurer] = "Insurer B",
        IF (
            MAX ( [Risk Class] ) = "Marine",
            [Total Premium] + [Insurer C Marine Premium],
            [Total Premium]
        ),
    [Total Premium]
)

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @MarkEden ,

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team _ kalyj

It is. Many thanks for your help.

MarkEden
Frequent Visitor

@v-yanjiang-msft thanks for this. I'll test this out. I think it might need a couple more variations but I can see the logic now.

v-yanjiang-msft
Community Support
Community Support

Hi @MarkEden ,

According to your description, in my understanding, you want for example for Insurer B, only when the Risk Class row is Marine, it should be "[Total Premium] + [Insurer C Marine Premium]", otherwise, it should be "[Total Premium]".

If this is the case, here's my solution.

Total including variations =
SWITCH (
    TRUE (),
    [Selected Insurer] = "Insurer A",
        [Total Premium] + [Insurer C Accident & Health Premium] + [Insurer C Professional Risks Premium],
    [Selected Insurer] = "Insurer B",
        IF (
            MAX ( [Risk Class] ) = "Marine",
            [Total Premium] + [Insurer C Marine Premium],
            [Total Premium]
        ),
    [Total Premium]
)

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.