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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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