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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Value difference-Slicer multi selection

Hi Team,

 

I have Product and value , if I select any two Product I need two lines with varience value of both ex. (P1-P2)

3rd lines expected (P1, P2 and varience line)

how to create Varience line in the below chart.

Note: I have select any two product names.

Capture1.PNG

 

Dim date.PNG

 

Thanks,

KV's

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check:

 

1. Create a separate table.

Products = 
UNION ( DISTINCT ( 'Table'[Product] ), { "Variance" } )

 

2. Create a measure.

Measure = 
VAR P1_ =
    MAX ( 'Table'[Product] )
VAR P1_Value =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Product] = P1_ )
VAR P2_ =
    MIN ( 'Table'[Product] )
VAR P2_Value =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Product] = P2_ )
RETURN
    SWITCH (
        MAX ( Products[Product] ),
        "Variance", P2_Value - P1_Value,
        P1_, P1_Value,
        P2_, P2_Value
    )

 

3. Create a line chart.

variance.gif

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check:

 

1. Create a separate table.

Products = 
UNION ( DISTINCT ( 'Table'[Product] ), { "Variance" } )

 

2. Create a measure.

Measure = 
VAR P1_ =
    MAX ( 'Table'[Product] )
VAR P1_Value =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Product] = P1_ )
VAR P2_ =
    MIN ( 'Table'[Product] )
VAR P2_Value =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Product] = P2_ )
RETURN
    SWITCH (
        MAX ( Products[Product] ),
        "Variance", P2_Value - P1_Value,
        P1_, P1_Value,
        P2_, P2_Value
    )

 

3. Create a line chart.

variance.gif

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

amitchandak
Super User
Super User

@Anonymous , You need to have three measures like

 

P1 = calculate(sum(Table[Value]), filter(Table, Table[Product] = "P1"))
P2 = calculate(sum(Table[Value]), filter(Table, Table[Product] = "P2"))

varience = [P1] -[P2]

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak ,

 

I have select any two Product names.

 

Thanks,

KV's

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.