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
Gumberculeez
Helper II
Helper II

Getting last 90 days of data

Hey all;

 

I'm trying to create a real time DSI and having difficulty on the last 90 days measure.  

 

Here is my measure below, and it "passes" however I get the following error.

 

Rev90 = CALCULATE([Revenue], DATESINPERIOD(GLTransDetails[Date], TODAY(), -90, DAY))
 
Gumberculeez_0-1709654311558.png

is there another "dates" DAX variable I should be using to get my last 90 days of sales?

 

1 ACCEPTED SOLUTION
Gumberculeez
Helper II
Helper II

Thanks to GPT :)... got it to work.  For FYI:

 
Rev90 = CALCULATE(
    [Revenue],
    FILTER(
        'GLTransDetails',
        'GLTransDetails'[Date] >= TODAY() - 90 && 'GLTransDetails'[Date] <= TODAY()
    )

 

this pulls passes, and does not error.

View solution in original post

3 REPLIES 3
Gumberculeez
Helper II
Helper II

Thanks to GPT :)... got it to work.  For FYI:

 
Rev90 = CALCULATE(
    [Revenue],
    FILTER(
        'GLTransDetails',
        'GLTransDetails'[Date] >= TODAY() - 90 && 'GLTransDetails'[Date] <= TODAY()
    )

 

this pulls passes, and does not error.

amitchandak
Super User
Super User

@Gumberculeez , if you need based on today

 

Last 90 =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = _max -90
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

or

 

 

Last 90 =
var _max =  today()
var _min = _max -90
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

or

 

Last 90 =
var _max =  today()
var _min = _max -90
return
CALCULATE([net] ,filter('Date','Date'[Date]>= _min && 'Date'[Date] <= _max))

 

 

Both of those generate the same error.

Gumberculeez_0-1709657406256.png

 

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.