Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Team, I hope you all are doing great. I am a newbie to DAX and PBI annd currenntly working on a task to predict cost. I had to calculate the slope(which I did using the Linest function) and add this slope to the preceeding value(where preceeding value = previous day cost). so,
cost prediction for today= actual value of previous day + slope and if there is no actual value present(in the case of future days), then
cost prediction for future = last calculated cost prediction + slope
so I wrote a dax formula,
Solved! Go to Solution.
@Alicetemitope No, but you could do this potentially:
Measure =
VAR __Date = MAX('Table'[Date])
VAR __Table =
ADDCOLUMNS(
DISTINCT(ALLSELECTED('Table'[Date])),
"__DailyCost",[Amortized Cost(E)
)
VAR __MaxDate = MAXX(FILTER(__Table, [__DailyCost] <> BLANK()), [Date])
VAR __Value = MAXX(FILTER(__Table, [Date] = __MaxDate), [__DailyCost])
VAR __Result = __Value * [Slope]
RETURN
__Result
@Alicetemitope No, but you could do this potentially:
Measure =
VAR __Date = MAX('Table'[Date])
VAR __Table =
ADDCOLUMNS(
DISTINCT(ALLSELECTED('Table'[Date])),
"__DailyCost",[Amortized Cost(E)
)
VAR __MaxDate = MAXX(FILTER(__Table, [__DailyCost] <> BLANK()), [Date])
VAR __Value = MAXX(FILTER(__Table, [Date] = __MaxDate), [__DailyCost])
VAR __Result = __Value * [Slope]
RETURN
__Result
@Greg_Deckler thank you so much for your help. Your suggestion helped in fine tuning my calculations. In the end, we stopped this approach and decided to use OLS for the predictions. which was much easier and made more sense.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
63 | |
62 | |
52 | |
39 | |
24 |
User | Count |
---|---|
85 | |
57 | |
45 | |
43 | |
38 |