Forum Discussion

kodalisatish's avatar
kodalisatish
Frequent Visitor
7 years ago
Solved

Difference between two rows with multiple filters

I am trying to build a report to show the percent change form same quarter one year prior with the following data. I tried to generate the difference using a DAX formula(Column and Measure) but couldn't get it to work.

 

 

State Values Year Quarter
DC 185 2017 q4
ME 339 2017 q4
MA 2036 2017 q4

DC 186 2017 q3
ME 393 2017 q3
MA 2034 2017 q3

DC 196 2017 q2
ME 426 2017 q2
MA 2370 2017 q2

DC 183 2017 q1
ME 304 2017 q1
MA 2075 2017 q1

DC 172 2016 q4
ME 327 2016 q4
MA 1977 2016 q4

DC 184 2016 q3
ME 387 2016 q3
MA 2168 2016 q3

DC 179 2016 q2
ME 440 2016 q2
MA 2308 2016 q2

DC 160 2016 q1
ME 387 2016 q1
MA 2121 2016 q1

DC 174 2015 q4
ME 399 2015 q4
MA 2269 2015 q4

I am a new user of powerbi, any help is appreciated. I am open to formatting the data differently if that helps.

  • Hi@ kodalisatish 

    After my research , you can do these follow my steps like below:

    Step 1:

    Add two measure

    Measure = CALCULATE(SUM(Table1[Values]))
    Measure 2 = var maxy=MAX(Table1[Year]) return CALCULATE(SUM(Table1[Values]),Table1[Year]=maxy-1)

    Step 2:

    Add difference

    Difference = [Measure]/[Measure 2]

    Step 3:

    Drag Year ,Quarter ,Difference and other fields into table visual

     

    Result:

    Best Regards,

    Lin

1 Reply

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    Hi@ kodalisatish 

    After my research , you can do these follow my steps like below:

    Step 1:

    Add two measure

    Measure = CALCULATE(SUM(Table1[Values]))
    Measure 2 = var maxy=MAX(Table1[Year]) return CALCULATE(SUM(Table1[Values]),Table1[Year]=maxy-1)

    Step 2:

    Add difference

    Difference = [Measure]/[Measure 2]

    Step 3:

    Drag Year ,Quarter ,Difference and other fields into table visual

     

    Result:

    Best Regards,

    Lin