BookmarkSubscribeRSS Feed
znhnm
Quartz | Level 8

Hello, 

 

I have 2 measure variables in my dataset. Lets call them var1 and var2. I would like to create a very simple calculated item: var1 / var2

The problem is when I make this calculation, it gives me 0s for all te records, but both var1 and var2 variables having values greater than 0. So this calculation is obviously wrong. 

Example: var1: $20,000.00, var2: $5,000.00

ratio should be 400%, but it gives 0%

To try to debug, I created a calculated item,  using only var1, and I was seeing the values of var1 correctly. Same for var2. The problem arises when I added / between two of them. 

I have no idea why it could be happening, please let me know if you have any ideas how to fix that.  

One point that might be relevant, the measure variables I am using, var1 and var2 are also calculated items I created on VA. 

Thank you! 


2 REPLIES 2
PaigeMiller
Diamond | Level 26

Show us your code. Show us the log. Show us a portion of the data.

--
Paige Miller
acordes
Rhodochrosite | Level 12

You do not address correctly your problem. 

Here at SAS communities when you do not get an answer within a few hours, it's not the community's lack of willingness to help or knowledge, it's about how YOU frame the problem. 

So, in your case a screenshot of some rows of your table would be of great help.

I suppose that var1 and var2 do not occur in the same row, therefore the division has to be done via aggregated measure. 

In the easiest case you could solve it by using the by_group sum operator within the division. 

The magic of VA is its ease to summarize in a dynamic context. 

When doing calculations you should always check first on detail level meaning that you need to go to row-level. 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 477 views
  • 0 likes
  • 3 in conversation