3 Replies Latest reply: May 12, 2016 7:13 AM by Stefan Wühl

# how to get independent values or totals from the below expression

Hi,

how to get independent values or totals from the below expression wherein i am getting the single total value :

=If((WeekDay(timedataend1)='Sat') or (WeekDay(timedataend1)='Sun') AND Time(Frac(timedataend1))>=Time('20:00:00') AND Time(Frac(timedataend1))<=Time('09:59:59'),sum((channelvalue)/1000*13),If((Time(Frac(timedataend1))>=Time('13:00:00') AND Time(Frac(timedataend1))<=Time('16:59:59')),sum ((channelvalue)/1000*15),sum( (channelvalue)/1000*11)))

Detailed description :

I need three seperate totals to show in the chart :

=If((WeekDay(timedataend1)='Sat') or (WeekDay(timedataend1)='Sun') AND Time(Frac(timedataend1))>=Time('20:00:00') AND Time(Frac(timedataend1))<=Time('09:59:59'),Total A,If((Time(Frac(timedataend1))>=Time('13:00:00') AND Time(Frac(timedataend1))<=Time('16:59:59')),Total B,Total C)

• ###### Re: how to get independent values or totals from the below expression

A single expression will always return a single value, unless you are using dimensions to split expression results into parts.

Hence, if you want to show three lines / bars etc. for your Totals, you can't just use a single expression, you need to use either three expressions or a dimension ( could be a synthetic dimension using ValueList()).

I assume you are either using dimensions already or you are selecting to a single record, because you are not using aggregation functions in your conditions.

I am not really sure what you are trying to achieve, so some sample data records and your exected result would definitely help.

Besides that, note that a boolean statement like

Time(Frac(timedataend1))>=Time('20:00:00') AND Time(Frac(timedataend1))<=Time('09:59:59')

will never be TRUE (a single timedataend1 value obviously can't fulfill the condition).

• ###### Re: how to get independent values or totals from the below expression

I want to store the three different totals which i get for further calculation, is there any way to store the result dynamically in a variable.

i.e

=If((WeekDay(timedataend1)='Sat') or (WeekDay(timedataend1)='Sun') AND Time(Frac(timedataend1))>=Time('20:00:00') AND Time(Frac(timedataend1))<=Time('09:59:59'),

"store the result in some variable" =Total A,If((Time(Frac(timedataend1))>=Time('13:00:00') AND Time(Frac(timedataend1))<=Time('16:59:59')),"store the result in some variable"=Total B, "store the result in some variable"=Total C)

• ###### Re: how to get independent values or totals from the below expression

You can create three variables and use an expression for the variable definition, but I am still unsure how these expressions should look like.

In general, consider that you need to define about what set of records you want to aggregate, i.e. your aggregation scope. Then define an aggregation.

The Aggregation Scope

Use Aggregation Functions!

If you need help to define both, then please describe your data (model) and requirement(s) a bit more detailed, adding some sample lines of records and expected results.