Forum Discussion
SUMMARIZE WITH DATE AND OTHER CONDITONS
- Anonymous1 year ago
Hi GCH_FR
Thank you for reaching out microsoft fabric community forum.The cumulative calculation logic in your current setup may be producing incorrect results due to the use of the EARLIER function, which can create context-related issues when used in complex filters or nested row contexts. A more robust and reliable approach is to use the ALLEXCEPT function, which ensures that the cumulative sum is correctly calculated for each "CODIFICATION" by preserving its context while allowing the accumulation over time. For example, the DAX expression:
CumulativeTimeBPA =
CALCULATE (
SUM ( [DailyTimeBPA] ),
FILTER (
ALLEXCEPT ( DailyTime, DailyTime[CODIFICATION] ),
DailyTime[Date] <= EARLIER ( DailyTime[Date] )
)
)ensures that for each row, the sum includes all previous dates for the same "CODIFICATION" without being disrupted by unrelated filters.
If this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community
Thank you.
Hi GCH_FR
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.