Forum Discussion

Rajesh1's avatar
Rajesh1
Helper I
8 years ago
Solved

Dynamically calculating cost based on user input quantity

Good day,   A sample of our product cost matrix per zone is as below: Zone Product Unit Cost Fixed service charges Quantity From Quantity To Variable Charges per unit USA P1 350 15 ...
  • Zubair_Muhammad's avatar
    8 years ago

    Hi Rajesh1

     

    Try this

     

    You can pull the Applicable Variable Charge from "Cost Matrix" to your "Input Table" using this MEASURE

     

    Applicable Variable Charge =
    CALCULATE (
        VALUES ( CostMatrix[Variable Charges per unit] ),
        FILTER (
            CostMatrix,
            CostMatrix[Product] = SELECTEDVALUE ( 'InputTable'[Product] )
                && CostMatrix[Zone] = SELECTEDVALUE ( 'InputTable'[Zone] )
                && SELECTEDVALUE ( 'InputTable'[Input Qty] ) >= CostMatrix[Quantity From]
                && SELECTEDVALUE ( 'InputTable'[Input Qty] ) <= CostMatrix[Quantity To]
        )
    )

  • Rajesh1's avatar
    Rajesh1
    8 years ago

    Thanks very much for your timely assistance, Zubair_Muhammad!

    Works like a charm!  thank you.. thank you.. thank you