cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
henkvankester
Helper I
Helper I

where do 2 lines meet each other in a line graph?

I have made a graph with multiple lines (pictured as below). What I would like to know is at which value of x (and y) the lines meet each other?

 

graph.png

 

My graph shows 2 lines. These are lines with the total amount we have to pay if we order more than 250 pieces of an item and a line with another price if we order more than 750 pieces of an item. 

When we order an amount between 638 - 750 pieces it'll be cheaper to order 750 items and that's where these lines in the graph match.

 

My dataset contains the following items: 

PriceMin. items to orderStart dateEnd dateProductMin total amount 
2,742501-1-202231-12-20221= Price * Min items to order
2,3297501-1-202231-12-20221= Price * Min items to order

 

1 ACCEPTED SOLUTION

Revise the metric to:

Dot = 
VAR temtable =
    SUMMARIZE (
        ALL ( Quantity ),
        Quantity[Value],
        Quantity[250],
        Quantity[750],
        "QuantityValues", ( SUM ( Quantity[250] ) - SUM ( Quantity[750] ) )
    )
VAR Q750 =
    MAX (
        MAXX ( FILTER ( temtable, [QuantityValues] < 1 ), Quantity[Value] ),
        MINX ( FILTER ( temtable, [QuantityValues] > -1 ), Quantity[Value] )
    )
RETURN
    Q750

MFelix_0-1674673613301.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

7 REPLIES 7
henkvankester
Helper I
Helper I

My Power BI file is here: https://we.tl/t-tj55SfNr5M

 

For now I don't have anymore dan a sample, we are still developing a database en screens for it.

Hi @henkvankester ,

 

I created the following measure:

Dot =
VAR temtable =
    SUMMARIZE (
        ALL ( Quantity ),
        Quantity[Value],
        Quantity[250],
        Quantity[750],
        "QuantityValues", ( SUM ( Quantity[250] ) - SUM ( Quantity[750] ) )
    )
VAR Q750 =
    MIN (
        MAXX ( FILTER ( temtable, [QuantityValues] < 1 ), Quantity[750] ),
        MINX ( FILTER ( temtable, [QuantityValues] > -1 ), Quantity[750] )
    )
VAR Q250 =
    MIN (
        MAXX ( FILTER ( temtable, [QuantityValues] < 1 ), Quantity[250] ),
        MINX ( FILTER ( temtable, [QuantityValues] > -1 ), Quantity[250] )
    )
RETURN
    IF (
        Q750 = SUM ( Quantity[750] )
            && Q250 = SUM ( Quantity[250] ),
        SUM ( Quantity[750] )
    )

 

Now added the measure to the visual and turn on the marker result:

MFelix_0-1674223876431.png

 

This is a simplification of the way we should calculate the intersection between the lines is not the matematical calculation but believe that we cna simplify.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks! I can indeed create a dot in the graph. What I'm really looking for is to add the value from the X-axis (quantity) in a card or table. When I try to do this with your measure the card shows 'empty'. 

Hi @henkvankester ,

 

Use the following code:

Dot = 
VAR temtable =
    SUMMARIZE (
        ALL ( Quantity ),
        Quantity[Value],
        Quantity[250],
        Quantity[750],
        "QuantityValues", ( SUM ( Quantity[250] ) - SUM ( Quantity[750] ) )
    )
VAR Q750 =
    MIN (
        MAXX ( FILTER ( temtable, [QuantityValues] < 1 ), Quantity[750] ),
        MINX ( FILTER ( temtable, [QuantityValues] > -1 ), Quantity[750] )
    )
RETURN
Q750

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks, only now I see the value of the Y-axis, but I'm looking for the value of the X-axis.

We would like to know at which point it is cheaper to order more items and now it shows whats how much it costs at that point. 

Revise the metric to:

Dot = 
VAR temtable =
    SUMMARIZE (
        ALL ( Quantity ),
        Quantity[Value],
        Quantity[250],
        Quantity[750],
        "QuantityValues", ( SUM ( Quantity[250] ) - SUM ( Quantity[750] ) )
    )
VAR Q750 =
    MAX (
        MAXX ( FILTER ( temtable, [QuantityValues] < 1 ), Quantity[Value] ),
        MINX ( FILTER ( temtable, [QuantityValues] > -1 ), Quantity[Value] )
    )
RETURN
    Q750

MFelix_0-1674673613301.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi @henkvankester ,

 

How are the lines created in the chart you are using the 250/750 column on the legend or are you using two metrics?

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.