cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Calculated Dimension Formula

former_member416162
Discoverer
0 Kudos

I'm new to Lumira and following the typical CR2013 formula text, trying to create a simple formula that will create a Calculated Dimension from a SQL column {ParkingDuration] :

if {ParkingDuration} < 60 then "1 Hour" else

if {ParkingDuration} > 120 and < 180 then "3 Hours" else

if {ParkingDuration} > 180 and < 240 then "4 Hours" else

if {ParkingDuration} > 240 and < 300 then "5 Hours" else

if {ParkingDuration} > 300 and < 360 then "6 Hours" else

if {ParkingDuration} > 360 and < 1440 then "7-24 Hours" else "> 24Hrs."

I keep getting "No viable alternative at "<". Try rewriting the formula.

i apologize in advance if I posted the question in the wrong forum.

Much Appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

former_member285534
Active Participant
0 Kudos

Hi John,

Correct syntax is as follows.  Notice that I modified slightly the logic so as to get the desired output (there were some gaps not considered in your original ranges, for instance 60 - 120, exactly 180, exactly 240, etc).

I also assumed 60 minutes is still considered as "1 hour", 120 still counts as "2 hours", etc.

if {ParkingDuration} <= 60 then "1 Hour" else

if {ParkingDuration} > 60 and {ParkingDuration} <= 120 then "2 Hours" else

if {ParkingDuration} > 120 and {ParkingDuration} <= 180 then "3 Hours" else

if {ParkingDuration} > 180 and {ParkingDuration} <= 240 then "4 Hours" else

if {ParkingDuration} > 240 and {ParkingDuration} <= 300 then "5 Hours" else

if {ParkingDuration} > 300 and {ParkingDuration} <= 360 then "6 Hours" else

if {ParkingDuration} > 360 and {ParkingDuration} <= 1440 then "7-24 Hours" else "> 24Hrs."

There are more simple formulas to achieve the same results, but for the moment this one will do the job.

Regards,

Fernando

Answers (1)

Answers (1)

former_member285534
Active Participant
0 Kudos

Here's a much simpler formula

if {ParkingDuration} <= 360 then Concatenate(Truncate( {ParkingDuration} / 60 + 1, 0), " Hour(s)") else if {ParkingDuration} <= 1440 then "7-24 Hours" else "> 24 Hrs."

I hope one of these two options correctly answers your question.

former_member416162
Discoverer
0 Kudos

Thank you Fernando, I see now what I missed - I like your simplified formula the most, thank you for that too. Is there page/document that describes or explains all available formulas in Lumira ?

Just curious as this will be very helpful.

former_member285534
Active Participant
0 Kudos

You're welcome John.  You can find a Functions Reference on the Desktop Edition User Guide. Currently, the most recent version is 1.28.  Refer to page 75.  I'm attaching the pdf download link.

http://help.sap.com/businessobject/product_guides/vi01/en/lum_128_user_en.pdf

Another resource which might be helpful is