Forum Discussion
Measure for an Amount Calculation between two days/Columns
Hi all,
I'm struggling with a simple Measure.
I have the following Table: -
Now I want to calculate it the following way: IF ( Netting Amount from the previous Day = 0, ('ResultIfTrue'), ('ResultIfFalse'))
For Example for the column 03/08/2021, I want to calculate: IF (Netting Amount from 02/08/2021 = 0 ....)
I do not know how to define the "Netting Amount from the previous Day".
I hope you can help with answering this question and thanks a lot for your help!
BR
Try to create a measure like below:
Measure = var current_ = SELECTEDVALUE('Table (2)'[Date]) var previous_ = current_-1 return CALCULATE(SUM('Table (2)'[value]),FILTER(ALLSELECTED('Table (2)'[Date]),'Table (2)'[Date]=previous_))
3 Replies
- V-lianl-msftCommunity Support
Try to create a measure like below:
Measure = var current_ = SELECTEDVALUE('Table (2)'[Date]) var previous_ = current_-1 return CALCULATE(SUM('Table (2)'[value]),FILTER(ALLSELECTED('Table (2)'[Date]),'Table (2)'[Date]=previous_)) - AnonymousNot applicable
Hi, thank you very much - it works with one exception.
We only have working days here and after a weekend there is a missing value. Do you know any solution that we show the value from friday and not not from sunday on monday?
Thank you and BR- V-lianl-msftCommunity Support
Try to modify the measure:
Measure 2 = var week_day = WEEKDAY(MAX('Table'[Date]),2) var current_ = SELECTEDVALUE('Table'[Date]) return IF(week_day=1, CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'[Date]),'Table'[Date]=current_-3)), CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'[Date]),'Table'[Date]=current_-1)))