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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Subash_G
Frequent Visitor

Display line chart with one line showing standard timeline and actual timeline against quantity

Hi All,

I am fairly new to Power BI and having trouble in achieving below requirement.  Can you please advise some pointers on how to achieve the requirement.

 

Requirement details:

I have two tables, one table has details about Product Confirmation data (Table 1) and one table has details about Standard time taken for each piece (Table 2).

 

Table 1:

ORDER_NUMOP_NUMQuantityActual TimeUnit  Confirmation_Time
45678900070112MIN1/20/2021 7:39:00 AM
45678900070111MIN1/20/2021 7:50:00 AM
45678900070110MIN1/20/2021 8:00:00 AM
4567891001017MIN

1/20/2021 8:07:00 AM

4567891001018MIN1/20/2021 8:15:00 AM
45678910010110MIN1/20/2021 8:25:00 AM

 

Table 2:

ORDER_NUMOP_NUMStandard_Mins_Per_PieceUnitPieces
456789000705.878MIN1
456789100107MIN1

 

I tried to combine the above two tables to get the output table as shown below.

ORDER_NUMOP_NUMQty_Running_TotalActual Mins Per PieceActual Total MinsStandard Mins per PieceTime
45678900070112125.878
456789000702112311.756
456789000703103317.634
456789100101777
45678910010281514
456789100103102521

 

Based on above table, i am planning to represent the data in line chart where one line shows based on actual time taken per piece against standard time taken per piece.

 

Thanks,

Subash

 

1 ACCEPTED SOLUTION

Hi @Subash_G ,

 

Create a table with the 1 to 500 quantities using the following syntax:

Quantity = GENERATESERIES(1,500, 1)

 

Now add the two following measures:

Actuals_Value = 
VAR temp_table =
    SUMMARIZE (
        'Table 1',
        'Table 1'[  Confirmation_Time],
        'Table 1'[Actual Time],
        'Table 2'[OP_NUM],
        'Table 2'[ORDER_NUM],
        "QtyRun", [Qty runnning total],
        "Act_Min", [Actuals Total Minutes],
        "Std_Min", [Standard time]
    )
RETURN
    AVERAGEX (
        FILTER ( temp_table, [QtyRun] = SELECTEDVALUE ( Quantity[Value] ) ),
        [Act_Min]
    )

Standard_Value = 
VAR temp_table =
    SUMMARIZE (
        'Table 1',
        'Table 1'[  Confirmation_Time],
        'Table 1'[Actual Time],
        'Table 2'[OP_NUM],
        'Table 2'[ORDER_NUM],
        "QtyRun", [Qty runnning total],
        "Act_Min", [Actuals Total Minutes],
        "Std_Min", [Standard time]
    )
RETURN
    AVERAGEX (
        FILTER ( temp_table, [QtyRun] = SELECTEDVALUE ( Quantity[Value] ) ),
        [Std_Min]
    )

 

Now create your line chart:

MFelix_0-1611575833115.png

Be aware that I'm using the AVERAGEX so if you have more than one product, order number or whatever other context it will give you the average of those values this can be change to SUMX, MINX or MAXX according to your needs.

 


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

6 REPLIES 6
Subash_G
Frequent Visitor

Hi Miguel Felix,

 

Firstly, Thanks for the response.

 

The solution you provided is working as expected except for one small issue, basically i want to plot the X-axis by Quantity not by the order number.  I checked the pbix file and found that for the Quantity Running total we are using a measure, as you know we cannot use that as X-axis.  Is there any way to achieve this requirement please.

 

Thanks,

Subash G

Hi @Subash_G 

 

When you say you want to plot by quantity and not order number what is the quantity you want to plot the cumulative quantity? And if you are using quantity on the x-axis what ar you considering in the values?


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



Basically X-axis will have values from 1 to max 500 quantity, that is 1,2,3,4,5,6....500.  Basically for a given product for making one product what is the standard time against the actual time is what i am trying to plot here..  Like wise for 2 quantity, 3 quantity etc.,

 

so X-axis will have quantity number from 1,2,3,4,....500 and Y-axis will have the mins..

 

Thanks,

Subash

Hi @Subash_G ,

 

Create a table with the 1 to 500 quantities using the following syntax:

Quantity = GENERATESERIES(1,500, 1)

 

Now add the two following measures:

Actuals_Value = 
VAR temp_table =
    SUMMARIZE (
        'Table 1',
        'Table 1'[  Confirmation_Time],
        'Table 1'[Actual Time],
        'Table 2'[OP_NUM],
        'Table 2'[ORDER_NUM],
        "QtyRun", [Qty runnning total],
        "Act_Min", [Actuals Total Minutes],
        "Std_Min", [Standard time]
    )
RETURN
    AVERAGEX (
        FILTER ( temp_table, [QtyRun] = SELECTEDVALUE ( Quantity[Value] ) ),
        [Act_Min]
    )

Standard_Value = 
VAR temp_table =
    SUMMARIZE (
        'Table 1',
        'Table 1'[  Confirmation_Time],
        'Table 1'[Actual Time],
        'Table 2'[OP_NUM],
        'Table 2'[ORDER_NUM],
        "QtyRun", [Qty runnning total],
        "Act_Min", [Actuals Total Minutes],
        "Std_Min", [Standard time]
    )
RETURN
    AVERAGEX (
        FILTER ( temp_table, [QtyRun] = SELECTEDVALUE ( Quantity[Value] ) ),
        [Std_Min]
    )

 

Now create your line chart:

MFelix_0-1611575833115.png

Be aware that I'm using the AVERAGEX so if you have more than one product, order number or whatever other context it will give you the average of those values this can be change to SUMX, MINX or MAXX according to your needs.

 


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 for your help, it worked perfectly !!!

 

Regards,

subash

MFelix
Super User
Super User

Hi @Subash_G ,

 

I assume that the Table 2 has only one value per order if that is true you can do a relationship between both tables and then add the following measures:

 

Qty runnning total =
CALCULATE (
    SUM ( 'Table 1'[Quantity] ),
    FILTER (
        ALL (
            'Table 1'[  Confirmation_Time],
            'Table 1'[ORDER_NUM],
            'Table 1'[Actual Time]
        ),
        'Table 1'[ORDER_NUM] = SELECTEDVALUE ( 'Table 2'[ORDER_NUM] )
            && 'Table 1'[  Confirmation_Time] <= MAX ( 'Table 1'[  Confirmation_Time] )
    )
)

Actuals Total Minutes =
CALCULATE (
    SUM ( 'Table 1'[Actual Time] ),
    FILTER (
        ALL (
            'Table 1'[  Confirmation_Time],
            'Table 1'[ORDER_NUM],
            'Table 1'[Actual Time]
        ),
        'Table 1'[ORDER_NUM] = SELECTEDVALUE ( 'Table 2'[ORDER_NUM] )
            && 'Table 1'[  Confirmation_Time] <= MAX ( 'Table 1'[  Confirmation_Time] )
    )
)

Standard time = SUM('Table 2'[Standard_Mins_Per_Piece]) * [Qty runnning total]

 

Now you can use this measures to create your tables and visualizations:

 

MFelix_0-1611340697611.png

Check PBIX file attach.


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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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