Solved

MDX Query filter column with value greater than zero

Posted on 2011-02-22
6
2,840 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now