Forum Discussion

Euro0681's avatar
Euro0681
Helper II
3 years ago

Matrix Subtracting column Values

I have matrix that has dates on columns, which are selected using a slicer and has Sales Amount as a value, and is broken down by Country on the Rows

Im wanted to create a measure that gives me the 2nd date - 1st date like below

If anybody could help Please!

2 Replies

  • Euro0681 , Assume you are using a measure and only 2 dates are selected

     

    then you can switch total using isinscope

     

    new measure =
    var _max = maxx(allselected(Date),Date[Date])
    var _min = minx(allselected(Date),Date[Date])
    return

    if(isinscope(Date[Date]), [Measure],
    calculate( [Measure], filter('Date', 'Date'[Date] =_min )) - calculate( [Measure], filter('Date', 'Date'[Date] =  =_max)) )

     

    if they are month

     

     

     

    new measure =
    var _max = maxx(allselected(Date),Date[Date])
    var _min = minx(allselected(Date),Date[Date])
    return

    if(isinscope(Date[Date]), [Measure],
    calculate( [Measure], filter('date',eomonth( 'date'[Date],0) =eomonth(_min,0) )) - calculate( [Measure], filter('date', eomonth('date'[Date],0) = eomonth(_max,0) )) )

    • Euro0681's avatar
      Euro0681
      Helper II

      When using in the matrix I get something like this

      Not as i expect any suggestion?