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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to calculate average orders created for past 30 days?

Hello Everyone,

 

We have received a requirement to create a Dashboard for the Orders created for a particular time frame.

For this we need to get the average orders created in last 30 days per user, May I know how should I use the formula to get this data so that I can present it in a similar way(Visuals)?

 

Note: Every Order number created has a unique number.

 

Thanks in Advance!

 

Regards,

Abhijith.

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have built a data sample:

Eyelyn9_0-1641173968707.png

 

  • If you want to calculate the count of orders / days (between datesperiod selected in slicer) for each user, you could use:
Measure = 
var _count=COUNTROWS('Table')
var _days=DATEDIFF(MIN('Table'[Date]),MAX('Table'[Date]),DAY)
return DIVIDE(_count, _days)+0

Eyelyn9_1-1641174087255.png

 

  • If you want to calculate  count of orders /  30 days before the selected date, you need to create a new calendar table for slicer and then create a measure:
Calendar = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])) 
Measure 2 = 
var _max=MAX('Calendar'[Date])
var _min=DATEADD('Calendar'[Date],-30,DAY)
var _count=CALCULATE(COUNTROWS('Table'),FILTER('Table',[User]=MAX('Table'[User]) && [Date]>=_min && [Date]<=_max))
return DIVIDE(_count,30)

Eyelyn9_2-1641174533870.png

 

 

Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have built a data sample:

Eyelyn9_0-1641173968707.png

 

  • If you want to calculate the count of orders / days (between datesperiod selected in slicer) for each user, you could use:
Measure = 
var _count=COUNTROWS('Table')
var _days=DATEDIFF(MIN('Table'[Date]),MAX('Table'[Date]),DAY)
return DIVIDE(_count, _days)+0

Eyelyn9_1-1641174087255.png

 

  • If you want to calculate  count of orders /  30 days before the selected date, you need to create a new calendar table for slicer and then create a measure:
Calendar = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])) 
Measure 2 = 
var _max=MAX('Calendar'[Date])
var _min=DATEADD('Calendar'[Date],-30,DAY)
var _count=CALCULATE(COUNTROWS('Table'),FILTER('Table',[User]=MAX('Table'[User]) && [Date]>=_min && [Date]<=_max))
return DIVIDE(_count,30)

Eyelyn9_2-1641174533870.png

 

 

Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@Anonymous Maybe post some data and the expected output. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.