MDX Handling Negative Values

582 views Asked by At

Do MDX queries not handle negative values very well? Not performance wise, but will you get strange results?

I have a strange result. In the first column of my fact table, I have some negative values that represent null key values.

I am not creating the MDX query. I'm simply dragging and dropping and the software is creating the MDX.

Edit Part 1: The software I am using is Pentaho User Console. In order to put it into the user console, I have to set the schema and cubes up using the schema workbench.

The actual data itself is accurate.

Normally when I drill down, I get results back to show what user console is drilling down on. With negative values; however, I do not get any values back. I think that MDX treats negative values differently, but I am a beginner with MDX and I'm only basing that on my 10-15 minute Google search.

Sample Data: dimension id values:

business_id, carrier_id, at_id, as_id, device_id, created_date_id, created_for_id, cancel_date_id, completed_date_id

Measure: activity_count

Sample values for each column:

-1, 100, 29, 1, 300, 4269, 500, 1020, -1, 1134

Activity count = 1

Edit Part 2:

I am working on getting the MDX logs.

To keep things simple, I am currently putting "business_id" on the rows, my only measure is "activity_count" and I'm trying to filter for business_id = -1.

I am inexperienced with MDX, but I imagine the MDX would look something like this:

select [measures] on columns
from [cube_name]
where [business_filters].[business_id] = -1

Now I'm currently getting an error message because it says

Mondrian Error:No function matches signature '<Level> = <Numeric Expression>'

But I THINK this is what the MDX would look like, sort of. What do you guys think?

Edit Part 3:

Interesting Fact: If I go to the database table, my measure value for business_id = -1 is not null for any row.

If I generate some MDX, the value is Null. If I replace the -1 value with a positive value, the returned measure is accurate. Why is this . . .

select
    non empty {[Measures]}
on  columns,
    [business_filters].[business_id].[-1]
on  rows
from
    [activities_fact_01]
1

There are 1 answers

0
Chicken Sandwich No Pickles On BEST ANSWER

I figured out what was wrong.

It had to do with having foreign key values that were not in dimensions. When I went to drill down in Pentaho, these results did not come back because the foreign keys did not have corresponding primary key values.

I spent 1.25 days trying to figure this out, but you can bet I'll never make that mistake again :)