Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rikkeqlik
Contributor III
Contributor III

Price group/interval match

I would like to use the following code, but with the sum of the field assosiated with IntervalMatch. Is that possible?

// PriceGroup:

// LOAD * Inline [

// Start,Stop,PriceGroup

// 0,    99.99,    0-100

// 100,    499.99,    100-500

// 500,    999.99,    500-1000

// 1000,    ,    Over 1000

// ];

// Join(PriceGroup)

// IntervalMatch(CataloguePrice)

// Load

//     Start,

//     Stop

// Resident PriceGroup;

// Drop Fields Start, Stop;

4 Replies
sunny_talwar

Sum of fields? can you elaborate with an example?

rikkeqlik
Contributor III
Contributor III
Author

I would like to create two groups; revenue>500' and revenue<500'. The purpose is to count entities with revenue>500' pr. quarter.

// RevenueGroup:

// LOAD * Inline [

// Start,Stop,PriceGroup

// 0,    499000,    less than 500'

// 500000,    ,   more than 500'

// ];

// Join(RevenueGroup)

// IntervalMatch(Revenue) <----------------- This is where I need Sum(Revenue) or else the results are showing only single lines over 500'

// Load

//     Start,

//     Stop

// Resident PriceGroup;

// Drop Fields Start, Stop;

rikkeqlik
Contributor III
Contributor III
Author

Forgot to change "PriceGroup", should be "RevenueGroup"

sunny_talwar

Why don't you create a new field before you do interval match?

Fact:

LOAD Entity,

     Quarter,

     ....,

     Revenue

FROM ...;

Left Join (Fact)

LOAD Entity,

     Quarter,

     Sum(Revenue) as TotalRevenue

Resident Fact

Group By Field1, Field2;

and now do interval match using Total Revenue....