Forum Discussion
Adding a sum to a table from list
- 4 years ago
Hi,
Total calculation logic uses the same dax as within the columns/rows it is trying to calculate total. However in the total calculation filter context e.g. using SELECTEDVALUE() return blanks. To combat this you can change the calculation logic of the measure for total values e.g. IF(SELECTEDVALUE('Table'[month])=blank(),[total calculation logic],[original calculation logic])
ValtteriN Thanks for the explanation. Where do i have to add the measure or function? Is the function correct? I don´t see the part where you grab the value from the INCOMING (list)?
- ValtteriN4 years ago
Community Champion
SvenJ
I understood you want the values from the table with month names as columns. Did I misunderstand. In the DAX I categorize whether or not values are incoming or out going based on if they are positive or negative and then I created two measures based on this. E.g. if the value is -5 for position 4444 in January the result is outgoing = -5 and incoming = blank() for the month and position in question.- SvenJ4 years ago
Helper III
ValtteriN No, the other way around. I want to read the values from the list and want the sum in the table with month
- ValtteriN4 years ago
Community Champion
This clarifies things,
The unpivot step remains the same, but instead of 2 measures we can use one.
Example data with incoming + outgoing columns:Dax:
Incoming/outgoing = var _m =SELECTEDVALUE(Incoming[Month])var _p = SELECTEDVALUE(Incoming[Position])var _value = calculate(SUM(IncomingFact[Incoming])-SUM(IncomingFact[OutGoing]),all(IncomingFact),IncomingFact[Month]=_m,IncomingFact[Position]=_p)return_valueEnd result: