Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Euro0681
Helper II
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

Euro0681_3-1671580644864.png

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

Euro0681_5-1671580803467.png

If anybody could help Please!

2 REPLIES 2
amitchandak
Super User
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) )) )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

When using in the matrix I get something like this

Euro0681_1-1671633532091.png

Not as i expect any suggestion?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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