Forum Discussion

calen's avatar
calen
Icon for Helper I rankHelper I
4 years ago
Solved

Help with Totaling

Hello All! 

 

I've got what I feel is a very simple problem but I can't quite figure out how to fix it. Below is a sample Dataset. I am trying to take the normal price - the discount price, then multiply that by the units sold to get the total discount. When I have it in a table, it works. When I put it in a card, the numbers go crazy. I am using the two measures below. What I want is a card that totals the "Total Discount" column which would be $6,765. What I am getting is $182,951 (the sum of discounts - $12 x total units - 15,246). Please help!

 

Unit Price - Discount =
SUM([Unit Price]) - AVERAGE([Discount Price])
 
Total Discount =
[Unit Price - Discount] * SUM([Quantity])

 

 

Item Average Unit Price Discount PriceUnit Price - Discount Quantity Total Discount
1 $                     15.00 $             14.00 $                         1.00               210 $              210
2 $                     20.00 $             19.00 $                         1.00            2,077 $           2,077
3 $                     19.00 $             18.00 $                         1.00            3,280 $           3,280
4 $                     10.00 $             10.00 $                              -              7,411 $                 -  
5 $                     23.00 $             22.00 $                         1.00                 35 $                35
6 $                     21.00 $             21.00 $                              -                 309 $                 -  
7 $                     24.00 $             23.00 $                         1.00                 85 $                85
8 $                     40.00 $             39.00 $                         1.00            1,003 $           1,003
9 $                     46.00 $             46.00 $                              -                 802 $                 -  
10 $                     66.00 $             62.00 $                         4.00                   4 $                15
11 $                     54.00 $             52.00 $                         2.00                 30 $                59
  • calen , I think it should be like

     

    Discount Amount =

    SUMX(Table, ([Unit Price] - [Discount Price])*[Quantity])

2 Replies

  • calen , I think it should be like

     

    Discount Amount =

    SUMX(Table, ([Unit Price] - [Discount Price])*[Quantity])

    • calen's avatar
      calen
      Icon for Helper I rankHelper I

      amitchandak Thank you for your help! The unit price comes from the item table, the discount price comes from the pricing table table, and the quantity comes from the sales table.  Is there a way to bring all three tables into the measure above?