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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Benedict21
Frequent Visitor

DAX repeating values

Hello, 

 

I am creating a forecast by averaging the previous 6 months data. I can get those values no problem. However, I want to repeat next month's forecast for the upcoming months. For example, I would like December 2022 value to repeat for January 2023, February 2023, etc. I tried taking the MAX value from the Incidents Forecast measure, but you cannot use that function on a measure. Any suggestions on how? Thank you!

 

DAX measures:

Incidents Forecast = 
VAR IncLM = CALCULATE([Incidents Average per Year Month], DATEADD(Dates[Date], -1, MONTH))

VAR Inc2M = CALCULATE([Incidents Average per Year Month], DATEADD(Dates[Date], -2, MONTH))

VAR Inc3M = CALCULATE([Incidents Average per Year Month], DATEADD(Dates[Date], -3, MONTH))

VAR Inc4M = CALCULATE([Incidents Average per Year Month], DATEADD(Dates[Date], -4, MONTH))

VAR Inc5M = CALCULATE([Incidents Average per Year Month], DATEADD(Dates[Date], -5, MONTH))

VAR Inc6M = CALCULATE([Incidents Average per Year Month], DATEADD(Dates[Date], -6, MONTH))

 

Return

DIVIDE((IncLM+Inc2M+Inc3M+Inc4M+Inc5M+Inc6M+), 6)

 

Cumulative Forecast = 

IF(ISBLANK([Incidents Average per Year Month]), [Incidents Forecast], [Incidents Average per Year Month])

 

IMG_2307 copy.jpg

6 REPLIES 6
amitchandak
Super User
Super User

@Benedict21 , Try a measure like using Incidents Forecast measure

 

calculate(lastnonblankvalues(Date[Date], [Incidents Forecast]), filter(all(Date), Date[Date] <= max(date[Date]) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi, 

 

Thank you, but the results are 0s and 1s.

I tried using this measure; however, it is not providing the correct result.

 

Test = 
CALCULATE(

LASTNOTBLANKVALUE('Dates'[Date], [Incidents Forecast]), FILTER(ALL('Dates'[Date], [Date] <=MAX('Dates'[Date])))

@Benedict21 ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I sent you a message with a link to the pbix. Thanks!

Hi! Thank you so so much for your help! I recreated the file with test data. I have 5 columns:
Date

Count of Incidents

Count Incidents Sum (measure)
Count Incidents rolling average (measure)

Cumulative Forecast (measure)

I want to repeat the forecasted value for the next month (9 in this case), and not continue the rolling average. So Jan 2023, Feb 2023, Mar 2023, etc., should all equal 9.

 

Thank you again for your help!
Capture.PNG
 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.