79158565

Date: 2024-11-05 10:03:07
Score: 0.5
Natty:
Report link

Using the code sent by Michal, I tested different formulas and now it works, I added the line "ALLSELECTED('Append')" followed by the line "PARALLELPERIOD('Append'[DATE_REFERENCE], -1, QUARTER)"

This line allows me to select all the values, even those that were previously filtered and not retrieved by "PARALLELPERIOD"

Here is the code

CalculateMeasure = 
VAR CurrentValue = SUM('Append'[Value])
VAR CurrentSale = SUM('Append'[Sale])
VAR PreviousQuarterValue = 
    CALCULATE(
        SUM('Append'[Value]),
        ALLSELECTED('Append'),
        PARALLELPERIOD('Append'[DATE_REFERENCE], -1, QUARTER)
    )
RETURN
    IF (
        CurrentValue <> 0,
        CurrentValue - PreviousQuarterValue,
        IF (
            CurrentValue = 0,
            CurrentSale - PreviousQuarterValue,
            BLANK()
        )
    )
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: QuentinGr