I am trying to create a measure object with defination like
sum(@Select(Sales\Quantity) * @Select(Sales\Unit sale price)) over (partition by @Select(Sales\Order number))
it is giving me parsing error, If I remove the partition by and make the over block empty it is parsing fine. But I need to include Order no in this case.
sum(@Select(Sales\Quantity) * @Select(Sales\Unit sale price)) over ()
Could you please help me resolve this issue, I need the solution asap and I am stuck. please help.
If I add a group by in SQL it works, but I don’t know if we can add group by in UDT.
select sum(( sum(Order_details.Quantity)) * (avg(Order_details.unit_sale_price)))
over (partition by (Order_details.order_number ))
from [gosales].order_details order_details
group by Order_details.order_number
Thank you Mak, I have gone through this post, so you mean we cannot use group by in Object definition. If I remove the aggregation from Order_details.Quantity (i.e. Sum) and Order_details.unit_sale_price (i.e. Avg) then I don’t require group by clause. see below SQL.
then it works in UDT, is it only because of ‘group by’, or my assumption is in correct.
select sum(( (Order_details.Quantity)) * ((Order_details.unit_sale_price)))
over (partition by (Order_details.order_number ))
from [gosales].order_details order_details
You are trying to deal with two different levels of aggregation in one object. If you are hoping to generate a ratio or %, this is best done at the report level.
I want to create an object in Universe, can this be done at Universe Level?? What is the purpose of Universe Parameter Property ‘DISTINCT_VALUES’ which is set to ‘GROUP BY’.
In summary is there any way to achieve this in UDT 4.1 Version: 14.1.2.1121.
To generate a group by you need a dimesnion object in the query and a SQL aggregation statement around the measure being created.
It looks to me like you wiah to process the rows at a transaction level and then divide by the aggregated total of all rows.
If it is possible in the universe the measure would have to be database delegated.
as Mak 1 stated better to do in report. for percentages and averages to ensure proper results you should grab the objects necessary to calculate the percentage or average into the report, then do a variable to get the calculation. sure you may be able to find a way to get this to work in a universe object, but depending on what other objects are selected along with it the results could be inconsistent. i’ve just learned this through experience.