Forum Discussion
KW123
4 years agoHelper V
Subtracting two rows
Hi, I am hoping someone can help. I have a column with sales values and I need to create a DAX where I minus A from B to get C but then take C and minus it from B to get D. Then D-B=E etc for t...
- 4 years ago
Hi KW123
Sorry it was too late yesterday I couldn't reply to you. Here is a sample file with the solution jnowing that you will retun back to me with more information that you've been hiding as usual 😉https://www.dropbox.com/t/lzKxh0DxLA056sy7Result = VAR A = 1000 VAR B = 10 VAR CurrentIndex = SELECTEDVALUE ( Data[INDEX] ) VAR MaxIndex = CALCULATE ( MAX ( Data[INDEX] ), ALLEXCEPT ( Data, Data[Day].[Month] ) ) RETURN IF ( CurrentIndex <> BLANK ( ), A - ( MaxIndex - CurrentIndex ) * B ) - 4 years ago
What does YTD total need to be = VAR A = [Accounting goal calc-c] VAR B = [Daily Goal] VAR CurrentIndex = SELECTEDVALUE ( Dates[FD2] ) VAR MaxIndex = CALCULATE ( MIN ( Dates[FD2] ), ALLEXCEPT ( Dates, Dates[Date] ) ) RETURN IF ( DAY ( SELECTEDVALUE ( Dates[Day] ) ) = 1 && MONTH ( SELECTEDVALUE ( Dates[Day] ) ) = 1, 0, IF ( CurrentIndex <> BLANK (), A + ( MaxIndex - CurrentIndex ) * B ) )