BookmarkSubscribeRSS Feed
Calcite | Level 5

Hello everyone,


I'm pretty new here and do have a question about the "caculated item" in VA reporting build. I hope, that someone can help me here. Thanks a lot.


The following "calculate item" was build in the VA report:


Sum [_ByGroup_] (( 'quantity'n *
'unit_price'n )) / Distinct [_ByGroup_] (
'oder: ID'n)


What I need is to build the summary of price and then divided by the number of orders, so I can get the average value of price pro order. In my data source table I have position of the order per row. So in the source I may have several rows with the same order ID but different position number. That's why I used "Distinct". But the summary of price is based on all the rows. So after I build the item it appeared under "Aggregated Measure" in the left side of the VA. But when I try to drop this item in my report. I got the "Error Message"Fehlermeldung_va.png


How can I get the average value and use it in my report??


Kind regards,




What is the data type of your numeric data items? They must be DOUBLE. 

Calcite | Level 5

@Madelyn_SASThanks a lot for the reply. I will try to change the "quantity" data type from "int32" to "double" and try it again!

Calcite | Level 5

Hi @Madelyn_SAS ,


though our developer still haven't change the data type of the numeric data items, I found another way to build the desired variable.

My way is to separate the item in 2 parts. So I build one calculated item A ('quantity'n * 'unit_price'n) and another calculated item B (Distinct [_ByGroup_] ('oder: ID'n)). Then I put them together in calculated item C: Sum [_ByGroup_] (A) / B. And it works!! Do you have any idea, why this new item works? I still don't get it at all. 😛







Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.


Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 


Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1 like
  • 2 in conversation