cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Helper II

## 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

2 REPLIES 2
Super User

@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) )) )

Helper II

When using in the matrix I get something like this

Not as i expect any suggestion?

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

#### Power BI Monthly Update - March 2024

Check out the March 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors