Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Dear Power BI Forum,
I am reviewing DAX Chapter 16 Advanced Calculations in DAX in the Numbering sequences of events section and the formula for the Order Position is not functioning. There is a problem with the Sales [Order Number] variable CurrentOrderNumber. A single value for column 'Order Number' in the table 'Sales' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result. I know this filed needs to be set to an iterator however I do not know which one. If anyone can assist with this I would greatly appreciate it.
OrderPosition =
VAR CurrentOrderNumber = Sales[Order Number]
VAR Position =
CALCULATE (
DISTINCTCOUNT ( Sales[Order Number] ),
Sales[Order Number] <= CurrentOrderNumber,
ALLEXCEPT (
Sales,
Sales[CustomerKey]
)
)
RETURN
Position
Thank you.
Solved! Go to Solution.
@lt79_Pax , current row context can be taken from min/max
This is approch for measure. In case column we can use earlier
OrderPosition =
VAR CurrentOrderNumber = max(Sales[Order Number])
VAR Position =
CALCULATE (
DISTINCTCOUNT ( Sales[Order Number] ),
Sales[Order Number] <= CurrentOrderNumber,
ALLEXCEPT (
Sales,
Sales[CustomerKey]
)
)
RETURN
Position
@lt79_Pax , current row context can be taken from min/max
This is approch for measure. In case column we can use earlier
OrderPosition =
VAR CurrentOrderNumber = max(Sales[Order Number])
VAR Position =
CALCULATE (
DISTINCTCOUNT ( Sales[Order Number] ),
Sales[Order Number] <= CurrentOrderNumber,
ALLEXCEPT (
Sales,
Sales[CustomerKey]
)
)
RETURN
Position
@lt79_Pax It depends on your end goal. Try this as a new column in the table instead of measure.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.