March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Hi Power BI Experts,
I am calculating the average rate of consumption per day for the current date to last one year.
Below is the sample screen shot of the requirement. Please help in creating the dax.
You can refer to the following example.
Create two columns in the table:
Rate = var a=MINX(FILTER('Table',[Date]>EARLIER('Table'[Date])),[Date])
var b=LOOKUPVALUE('Table'[Tank Level],[Date],a)
return [Tank Level]-b
Average_rate = AVERAGE('Table'[Rate])
Best Regards,
Xinru Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-xinruzhu-msft , Thanks for your reply.
For the above table there is another column as date & time which show's one every one date record it is divided into 60seconds*24hours=1440 records. I have added instead of date column with date & time. I tried to execute the above expression it is taking more than 1 hour to execute. How can i minimize the query after adding the date & time column instead of date. Please help.
Below is the expression i modified.
Rate = var a=MINX(FILTER('Table',[Date & Time]>EARLIER('Table'[Date & Time])),[Date & Time])
var b=LOOKUPVALUE('Table'[Tank Level],[Date & Time],a)
return [Tank Level]-b
Average_rate = AVERAGE('Table'[Rate])
The dateset is large, so the calculation will be affected, it cannot be minimized, you may need to
reduce the amount of data.
Best Regards,
Xinru Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
91 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
73 | |
68 |