Forum Discussion

Nayababbasi91's avatar
Nayababbasi91
Frequent Visitor
1 year ago
Solved

How to calculate sub-product quantity

Hi    I would like to know how to calculate the quantity of sub-products using the table provided.   Once I have the sub-product total Qty, I can create a measure to calculate % by Sub-prod...
  • DataNinja777's avatar
    1 year ago

    Hi Nayababbasi91 ,

     

    You can produce your required output by writing dax measures like below:

    Sub-product (all) = calculate(sum('Table'[Brand Qty]),all('Table'[Sub-product]))

    Then use the measure above in another measure to calculate the % share of the total.

    Sub-product quantity% = VAR Quantity= sum('Table'[Brand Qty])
    return 
    divide (Quantity,[Sub-product (all)])

    The resulting output looks like below:

     

    Best regards,