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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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