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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
prakash11440278
Post Prodigy
Post Prodigy

Average Rate of Consumption for the one year

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.

 

prakash11440278_1-1674971127279.png

 

 

3 REPLIES 3
v-xinruzhu-msft
Community Support
Community Support

Hi @prakash11440278 

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])

 

vxinruzhumsft_0-1675044141696.png

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])

Hi @prakash11440278 

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.

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.