Forum Discussion

DIROPS's avatar
DIROPS
Frequent Visitor
7 years ago
Solved

Calculate Yield

I need some assistance, I am trying to calculate the yield of a product (PLU) as it moves through work in progress steps.  The table I am working with lists all the PLU's in on column, the net weight of each PLU in another and the date of the actual transaction to the data capture system in another.  I am trying to figure out how I can visualize the percent difference between finished net weights of two different PLU's in a date range.  Any help would be appreciated.  Sample data attached.  Thanks in advance

 

sample data

  • Anonymous's avatar
    Anonymous
    7 years ago

    It would help to see the calculations as you have them and the visual you're trying to produce. 

    That said, here is how I did it - 2 slicer visuals, and 1 card visual:

     

11 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi DIROPS ,

    To do this, you would need to specify both PLUs. Assuming you would always be comparing 2 only, you could do the following:

     

    1. Create a calculated table with 2 columns, like this:

    PLUs = CROSSJOIN(
    SELECTCOLUMNS(DISTINCT(PLU_Table[PLU_Column]),"PLU Numerator",[PLU_Column]),
    SELECTCOLUMNS(DISTINCT(PLU_Table[PLU_Column]),"PLU Denominator",[PLU_Column])
    )
     
    2. Create a calculation:
    PLU % Yield =
    var num = IF(
    HASONEVALUE(PLUs[PLU Numerator]),
    CALCULATE(
    [Weight Calculation], //SUM(Weight)
    FILTER(Store, Store[Store Country] = VALUES(PLUs[PLU Numerator]))
    )
    ,0
    )
    var den = IF(
    HASONEVALUE(PLUs[PLU Denominator]),
    CALCULATE(
    [Weight Calculation], //SUM(Weight)
    FILTER(Store, Store[Store Country] = VALUES(PLUs[PLU Denominator]))
    )
    ,0
    )
    return DIVIDE(num, den)
     
    For the dates, that should work just by filtering.
     
    Hope this helps,
    Nathan
     
    • DIROPS's avatar
      DIROPS
      Frequent Visitor

      Got the first part working, by creat a calculation do you mean create a calculated coulumn in my new table or a measure?

      • Anonymous's avatar
        Anonymous
        Not applicable

        DIROPS  - 2nd part is a measure.