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
I want to calculate the average order value by # of order (AOV 1st order, 2nd order, 3rd order, …). Which DAX can I use to turn the table above to the table below? Thank you!!!
Solved! Go to Solution.
Hi @donglanmao1996 ,
Please create two new calculated columns:
AOG =
VAR _no_of_order = CALCULATE(COUNT('Table'[Index]),'Table'[Index] <= EARLIER('Table'[Index]),ALLEXCEPT('Table','Table'[User_ID]))
VAR _revenue = CALCULATE(SUM('Table'[Order_Value]),'Table'[Index] <= EARLIER('Table'[Index]),ALLEXCEPT('Table','Table'[User_ID]))
VAR _aog = DIVIDE(_revenue,_no_of_order)
RETURN
_aog
#_of_order = RANKX(FILTER('Table','Table'[User_ID]=EARLIER('Table'[User_ID])),'Table'[AOV],,DESC,Dense)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Thank you! Can you please have a look on my screenshot below. Is there a bug with sorting of index column and how can I fix it?
Hi @donglanmao1996 ,
Please create two new calculated columns:
AOG =
VAR _no_of_order = CALCULATE(COUNT('Table'[Index]),'Table'[Index] <= EARLIER('Table'[Index]),ALLEXCEPT('Table','Table'[User_ID]))
VAR _revenue = CALCULATE(SUM('Table'[Order_Value]),'Table'[Index] <= EARLIER('Table'[Index]),ALLEXCEPT('Table','Table'[User_ID]))
VAR _aog = DIVIDE(_revenue,_no_of_order)
RETURN
_aog
#_of_order = RANKX(FILTER('Table','Table'[User_ID]=EARLIER('Table'[User_ID])),'Table'[AOV],,DESC,Dense)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Thank you! Can you please have a look on my screenshot below. Is there a bug with sorting of index column and how can I fix it?
Hi @donglanmao1996 ,
It seems that the type of the [Index] column is now text, please change its type to whole number.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
116 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
170 | |
117 | |
63 | |
56 | |
51 |