Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Previous Measure

Hi
I am trying to return previous year quarter value but only for one value it is not returning other than that everything is showing correct 

Hi I am trying to fix promote prev measure the logic is it should take values from previous year quarter
For example 2025/q4 is 8772498 that value is showing 2026/q4 but 2027 q4 16538747 is not showing 2028/q1 

and it is segregated as tax distribution and promote values 

I am pasting expected output


I am pasting the dax which i used to achive this promote prev

Promote curr = CALCULATE(MAX('Promote Breakdown'[Promote (incl Tax Advances) new]))
Promote Prev =

VAR PrevValue =
    CALCULATE(
        [Promote curr],
        FILTER(
            ALL('Date'),
            'Date'[Period] < MAX('Date'[Period])
        )
    )
RETURN
    IF(
        ISBLANK(PrevValue),
        0,
        PrevValue
    )
VAR PrevValue =
    CALCULATE(
        MAX('Promote Breakdown'[Promote (incl Tax Advances)]),
        FILTER(
            ALL('Date'),
            'Date'[Period] < MAX('Date'[Period])
        )
    )
RETURN
    IF(
        ISBLANK(PrevValue),
        0,
        PrevValue
    )


Hi guys please suggest the issues or kindly help me to achive this 



  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Anonymous 

    Based on your description, I've created the following sample data:

    Create the following three measures:

    Promote cuff measure = SUM('Table'[Promote cuff])
    Promote prev = 
    CALCULATE([Promote cuff measure],OFFSET(-1,ALLSELECTED('Table'[Year Quarter],'Table'[Tax distribution])))
    Promote diff = [Promote cuff measure] - [Promote prev]

    Put it in the table visual:

     

     

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Anonymous 

    Based on your description, I've created the following sample data:

    Create the following three measures:

    Promote cuff measure = SUM('Table'[Promote cuff])
    Promote prev = 
    CALCULATE([Promote cuff measure],OFFSET(-1,ALLSELECTED('Table'[Year Quarter],'Table'[Tax distribution])))
    Promote diff = [Promote cuff measure] - [Promote prev]

    Put it in the table visual:

     

     

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous , Try using

     

    dax
    Promote curr = CALCULATE(MAX('Promote Breakdown'[Promote (incl Tax Advances) new]))

    Promote Prev =
    VAR CurrentPeriod = MAX('Date'[Period])
    VAR PreviousYearPeriod = CurrentPeriod - 4
    VAR PrevValue =
    CALCULATE(
    [Promote curr],
    FILTER(
    ALL('Date'),
    'Date'[Period] = PreviousYearPeriod
    )
    )
    RETURN
    IF(
    ISBLANK(PrevValue),
    0,
    PrevValue
    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi IT IS showing 0 for all feilds