Solved

MDX Query filter column with value greater than zero

Posted on 2011-02-22
6
3,023 Views
Last Modified: 2012-05-11
I have this query

Select  
{[Buckets].[Header].[AGHeader]} on columns
,

Filter(
{[Account].[Accounts Name].[Name]} ,
([Measures].[Summary_Value]>0)
) ON ROWS


from capa
Where  [Buckets].[Type].&[AR]


which produces output similar to

-----------  Col1 col2 col3

ABC CO      1      0      1
BCE Co       2      0      2
HEO CO      3      1     2


I need to filter so results only contain the rows where col2 has a value greater than zero.

I am new to mdx so not sure what other info I need to provide.

0
Comment
Question by:JonMny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 15

Accepted Solution

by:
derekkromm earned 250 total points
ID: 34957630
Is AGHeader a named set? I tried basically an identical select on one of my dbs and it filtered as expected.

What if you try this:

Select  
{[Buckets].[Header].[AGHeader],[Measures].[Summary_Value]} on columns,

Filter(
{[Account].[Accounts Name].[Name]} ,
([Measures].[Summary_Value]>0)
) ON ROWS


from capa
Where  [Buckets].[Type].&[AR]
0
 
LVL 9

Author Comment

by:JonMny
ID: 34962324
no not a named set,

The query seems to filter values that are zero but It's not quite what I need

I need to show all agheaders  and value for a specific account but filter to only the times when col2 has a zero value. the other columns can have a zero.




0
 
LVL 10

Expert Comment

by:itcouple
ID: 34964263
Hi

Might be worth posting entire query. The syntax you used is correct. Just ensure you use the correct measures that generates values for column 2.

Regards
Emil
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 9

Author Comment

by:JonMny
ID: 34964703
I will try to create a more complete example.


here is a what i want to due but of course doesnt work.

from capa
Where  [Buckets].[Type].&[AR]
and
( [Buckets].[AgingHeader].&[52] and [Measures].[Invoice_Amount]>0)


0
 
LVL 10

Assisted Solution

by:itcouple
itcouple earned 250 total points
ID: 34964781
Hi

Is that the complete query?

Using where may produce unexpected results with MDX. use [Measures].[Invoice_Amount]>0) using filter on rows.

If you know T-SQL (like me) then forget about it!! It will be much easier :)

Regards
Emil

0
 
LVL 9

Author Comment

by:JonMny
ID: 34981603
The issue I am having is that all three columns are tied to the invoice_amount. So if I filter invoice amount> 0 I end up filtering columns that I need.


0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question