Sum total from enumlist

Hello everybody
consider that I am trying to learn…
I ask some pious soul to help me with this problem:
I have two tables:

  • products
  • sales
    from the sales table I should automatically calculate the total price of the products chosen from a ref field of type enumlist populated from the products table.
    I have tried various ways, but it fails, I used the following formula:
    SUM (SELECT (PRODUCTS [PRICE], IN (PRODUCTS [PRODUCT_ID], [_ THISROW]. [PRODUCT]), PRODUCTS [TYPE] = [_ THISROW]. [PRODUCT]))
    I’d like to use a for loop to solve, but I don’t know the syntax and don’t even know if it’s possible.
    Can anyone help me?
    Thank you
0 2 307
2 REPLIES 2

Hi @Giuliano_Negrisolo
Try something like this
SUM(
SELECT(
Tablename[PriceColumn],
IN(
[CostItemsColumnName],
[_THISROW].[EnumlistColumnName]
)
)
)

Hi lynn
Thanks a lot, it works!
I also understood where I was wrong, I learned something.

Top Labels in this Space