BookmarkSubscribeRSS Feed
Oliver_Weng
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,

 

Oliver

3 REPLIES 3
Madelyn_SAS
SAS Super FREQ

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

Oliver_Weng
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!

Oliver_Weng
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. 😛

 

Best,

 

Oliver

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 982 views
  • 1 like
  • 2 in conversation