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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

CalculateTable

I am trying to generate an average for the last 20 days(offset and get no value.

 

CurA =
AverageX(
CALCULATETABLE(
'FACT_PROD_CUM_VW',
Filter('FACT_PROD_CUM_VW',FACT_PROD_CUM_VW[Prod Date] < [CurStart]) , Filter('FACT_PROD_CUM_VW',FACT_PROD_CUM_VW[Prod Date] > [CurEnd])
),
[Gross Oil]
)

 

CurStart = min(FACT_PROD_CUM_VW[currentstart])

currentstart = DATE(YEAR(FACT_PROD_CUM_VW[Prod Date]),MONTH(FACT_PROD_CUM_VW[Prod Date]),DAY(FACT_PROD_CUM_VW[Prod Date])) -2

 

CurEnd = min(FACT_PROD_CUM_VW[currentend])

currentend = DATE(YEAR(FACT_PROD_CUM_VW[Prod Date]),MONTH(FACT_PROD_CUM_VW[Prod Date]),DAY(FACT_PROD_CUM_VW[Prod Date])) -20

 

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Unfortunately, I don't know your data model. Try to provide some sample data and the results you expect so that we can have a better understanding of your scenario.

How-to-provide-sample-data-in-the-Power-BI-Forum 

How-to-Get-Your-Question-Answered-Quickly 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

m3tr01d
Continued Contributor
Continued Contributor

So Let say today's date is 2021 June 15. 
What would be the value for CurStart and CurEnd in your measure?

Anonymous
Not applicable

It's not about Today....they will be 2 days before the value of prod_date and 22 days after prod_date respectively.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.