Summing conditional values

Discuss how to create custom stats, reports and HUD profiles and share your creations.

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Summing conditional values

Postby socorrista5 » Tue Oct 23, 2012 4:17 pm

Hello, I would like to sum all my winnings with hole cards AA, for example. I am trying to create a "Column" statistic to later use in as a "Stat" statistic.

The number of times a Hole AA happens is this:

sum(if[cash_hand_player_statistics.id_holecard = 1, 1, 0])

And I want to sum all my winnings in My Currency, so I would expect something like this??????:

sum(if[cash_hand_player_statistics.id_holecard = 1, cash_hand_player_statistics.amt_won_curr_conv, 0])

but it does not work, can you help me with this?

Thanks
socorrista5
 
Posts: 142
Joined: Mon May 24, 2010 7:56 am

Re: Summing conditional values

Postby WhiteRider » Tue Oct 23, 2012 4:36 pm

That looks like it should work - what problem are you seeing with that?
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Summing conditional values

Postby socorrista5 » Tue Oct 23, 2012 5:40 pm

I get this error message:

"The statement is not a valid SQL"
socorrista5
 
Posts: 142
Joined: Mon May 24, 2010 7:56 am

Re: Summing conditional values

Postby WhiteRider » Wed Oct 24, 2012 3:32 am

Ah, sorry - that isn't a valid database field. You need to do the currency conversion as a calculation as is done in the other _curr_conv Columns.

sum(if[cash_hand_player_statistics.id_holecard = 1, CAST( (cash_hand_player_statistics.val_curr_conv * cash_hand_player_statistics.amt_won) AS numeric ), 0] )
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Summing conditional values

Postby socorrista5 » Wed Oct 24, 2012 2:05 pm

Ok, now it works. Thanks!
socorrista5
 
Posts: 142
Joined: Mon May 24, 2010 7:56 am


Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 0 guests