Forum Discussion

Umeshp's avatar
Umeshp
New Member
7 years ago
Solved

Percentange Difference on selected Years only

Hi all ,
Here is my Question again ,
i  am getting year over year  % Difference by using Quick measure   or Dax  calculations. But my question is , if I select years randomly from the slicers it is displaying on the previous year difference only not with the selected years as shown in below images.

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
everything i need is to calculate the year over year difference on the selected  year from slicers ,  and if  all years selected  it has to display the previous year difference.



 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Thanks 
Umesh 

 

 
 
 
 
 
 
 
 
  • Umeshp,

     

    You may add the following measure.

    Measure =
    VAR y =
        MAXX (
            FILTER (
                ALLSELECTED ( Table1[Year] ),
                Table1[Year] < SELECTEDVALUE ( Table1[Year] )
            ),
            Table1[Year]
        )
    VAR prev =
        CALCULATE ( [total], Table1[Year] = y )
    RETURN
        IF ( NOT ( ISBLANK ( prev ) ), DIVIDE ( [total] - prev, prev ) )
    

1 Reply

  • v-chuncz-msft's avatar
    v-chuncz-msft
    Icon for Community Support rankCommunity Support

    Umeshp,

     

    You may add the following measure.

    Measure =
    VAR y =
        MAXX (
            FILTER (
                ALLSELECTED ( Table1[Year] ),
                Table1[Year] < SELECTEDVALUE ( Table1[Year] )
            ),
            Table1[Year]
        )
    VAR prev =
        CALCULATE ( [total], Table1[Year] = y )
    RETURN
        IF ( NOT ( ISBLANK ( prev ) ), DIVIDE ( [total] - prev, prev ) )