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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors