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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
SoufTC
Helper I
Helper I

How to put the min and max of a date filter in the calculation of a measure

Hello everyone,

I try to calculate a measure of the evolution of the likes according to the two selected date. 

Here is an example of my data:

PageLikesDate
P1122022-12-12
P1152022-12-24
P2252022-12-12
P2682022-12-24
............

 

On PowerBI I have the date in filter and a matrix with the selected pages and dates. Here is an example :

SoufTC_0-1645013032221.png

 

So the measure I'm trying to calculate for P1 for exemple is data['Likes'] in 2021-01-11 divide data['Likes] in 2020-12-28 

 

I don't know if it is possible to make the calculation according to the selected date or all the dates  !! Could someone tell me how to calculate a measure of the evolution ?

 

Thank's in advance,

bof,

1 ACCEPTED SOLUTION
SoufTC
Helper I
Helper I

I could find the solution by a calculation like this :
measure = CALCULATE (
SUM ( data[Likes] ),
LASTNONBLANK ( data[Date], SUM ( data[likes] ) )
)
 
 

View solution in original post

2 REPLIES 2
SoufTC
Helper I
Helper I

I could find the solution by a calculation like this :
measure = CALCULATE (
SUM ( data[Likes] ),
LASTNONBLANK ( data[Date], SUM ( data[likes] ) )
)
 
 
amitchandak
Super User
Super User

@SoufTC , Check if a measure like below can help

 

//Difference between two selected dates
diff =
var _max = maxx(allselected('Date'),'Date'[Date])
var _min = maxx(allselected('Date'),'Date'[Date])
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] =_max )) -
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] =_min ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors