Sum using this expression - but i need it to zero out per NEW ticket

I created a table with a column that should be getting the sum (total) of each particular field based on the new entry.
However, it is adding the total up in my table and using that total again even though i am generating a new ticket.

I used this expression:

SUM(airfare table[airfare amount])

Airfare Table - my table holding all airfare logs
Airfare Amount - amount for each individual airfare spent

I need this NOT to just keep adding them up. I want it to add up ALL airfare totals for that ONE ticket (expense request key)โ€ฆ

Thanks

Solved Solved
0 5 377
1 ACCEPTED SOLUTION

Got it! I had wrong keyโ€ฆ

SUM(SELECT(Airfare Table[Airfare Amount], [expense report key]=[_THISROW].[Key]))

Thank you so much!!!

View solution in original post

5 REPLIES 5

Bahbus
New Member

Try this:

SUM(SELECT(Airfare Table[Airfare Amount], [RowKey]=[_THISROW].[RowKey]))

Substitute [RowKey] with whatever is your Key column.

I tried it - it doesnโ€™t sum anything now. But it did go back to โ€œ$0โ€

I use the key from the new ticket table, correct? Not from the airfare table, which is where it puts the data.

Maybe i should have said this. I have two tables (well multiple tables) but within this issue. I have the first table that logs the tickets (new). That table (Expense Report) holds all new tickets. It has a Ref Row to that table above (Airfare Table). This table is โ€œisapartofโ€ the (Expense Report) table. I have a column in the first table (Expense Report) that needs to get the sum of ALL airfare amounts the user logs into the Expense Report.

Soโ€ฆ Here are my two tables:

Expense Report
[key] - this is my key column
[Total Airfare] - SUM(SELECT(Airfare Table[Airfare Amount], [Key]=[_THISROW].[Key]))

Airfare Table
[key] - this is the key column for this table
[expense report key] - this is where i place the key from the above table in the row

Got it! I had wrong keyโ€ฆ

SUM(SELECT(Airfare Table[Airfare Amount], [expense report key]=[_THISROW].[Key]))

Thank you so much!!!

Ah, yep. I thought it was all in one table. Good job!

Top Labels in this Space