The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
79 | |
78 | |
39 | |
36 |
User | Count |
---|---|
158 | |
111 | |
64 | |
59 | |
54 |