Forum Discussion

5B's avatar
5B
Regular Visitor
2 years ago
Solved

Assistance Needed with DAX Calculation

Hi all, 

I'm new to Power Bi and I'm having an issue with a calculation. I am trying to calculate the share of sales an item holds. This is done by dividing the number of items sold by the Total Sales of a selected period. Using the sample table below:

 

Total Sales = 14,700 (2500+9000+1500+1700)
Sales Share (Soft Drink) = Qty / Total Sales
                                       = 100 / 14700 = 0.006802721

DescriptionQtyTotal SalesSales Share
Soft Drink10025000.006802721
Pizza5790000.003877551
Burger2515000.00170068
Sandwich1717000.001156463

 

Best regards,
Stephanie.

3 Replies

    • 5B's avatar
      5B
      Regular Visitor

      Hey Tom,

      It worked! Thank you.

      I added in
      FILTER(ALL('Table'), 'Table'[Date] IN VALUES('Table'[Date]))

      Really appreciate it!

  • Hi, 5B 

     

    I will try my best to help. Try this:

     

    Total Shares Sales =
    VAR _TotalSales =
    CALCULATE(
        [Total],  
        ALL('TableName'[TotalSales])) // Your table name goes in 'TableName'
    Return
    DIVIDE(
        [Total Sales],
        _TotalDomains,0)
     
    Best,
    Cam