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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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