Forum Discussion

Jdsarmientoc's avatar
Jdsarmientoc
Frequent Visitor
6 years ago
Solved

Converting data from Kits to components

Hi all!   Im currently working on a simple model to do the stock planning and production requirements for some items. The thing is that some of those items are sold as Kits, therefore i would need...
  • lc_finance's avatar
    lc_finance
    6 years ago

    Hi David,

     

     

    I modified a bit the solution to take into account that there is a single master table, and that kits can be identified based on the column Tipo.

     

    You can download the updated solution from here.

     

    And here is the new DAX formula:

    Units sold = 
    
    var currentProduct = [Product]
    
    VAR productIsKit= LOOKUPVALUE('Masterdata'[Tipo],'Masterdata'[Product],currentProduct) = "Kit"
    
    VAR productSales = LOOKUPVALUE(Sales[Units sold],Sales[Item],[Product],0)
    
    VAR productSalesViaKit = SUMX(
        'Masterdata',
        IF([Item]=currentProduct,
        [Qty per kit]*LOOKUPVALUE(Sales[Units sold],Sales[Item],[Product],0)
        )
    )
    
    RETURN IF(productIsKit, 0, productSales+productSalesViaKit)

     

    It's very similar to before. The only main change is how to check whether the product is a kit. 

    Now the variable productIsKit looks at the 'Tipo' column: if the Tipo column is equal to kit, then it considers the product to be a kit.

     

    Hopefully, this matches all of your requirements

    Let me know if anything is unclear

     

    LC

  • lc_finance's avatar
    lc_finance
    6 years ago

    Hi David,

     

     

    I updated your file to include the calculation.

    You can download it from here.

     

    I hope that this is what you are looking for. If you need more help, do not hesitate to ask.

     

    LC

    Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com