Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:48:49+00:00 2026-06-04T15:48:49+00:00

I am trying to build a query with parameters using a calculated member. I

  • 0

I am trying to build a query with parameters using a calculated member.

I have created calculated members for judicial counts which are “hard coded” and the parameter I created does not effect the totals of each group.

However, I need to have each of the total counts listed with a working parameter. If there is no value for the selected judicial type a zero count should be displayed.

Im sure there is an easy way, but im fairly new to MDX/SSRS. Any help is greatly appreciated!

Here is the query:

WITH 

Member  [Measures].[Jud] as
        (
        [Dim Foreclosure Loan].[Judicial Flag].[1],
        [Dim Foreclosure Loan].[FCL Stage].&[Sale Held],
        [Measures].[Loan Count]
        )
Member  [Measures].[Non-Jud] as
        (
        [Dim Foreclosure Loan].[Judicial Flag].[0],
        [Dim Foreclosure Loan].[FCL Stage].&[Sale Held],
        [Measures].[Loan Count]
        )
Member  [Measures].[Total] as
        (
        [Dim Foreclosure Loan].[Judicial Flag],
        [Dim Foreclosure Loan].[FCL Stage].&[Sale Held],
        [Measures].[Loan Count]
        )
--------------------------------    Query Begins    --------------------------------
SELECT NON EMPTY
        {
        ([Dim Date].[Calendar].[Day].Members)
        } ON ROWS,
        NON EMPTY 
        ({
        ([Measures].[Jud]),
        ([Measures].[Non-Jud]),
        ([Measures].[Total])
        }) ON COLUMNS
        FROM ( SELECT ( STRTOSET(@DimForeclosureLoanJudicialFlag, CONSTRAINED) ) ON COLUMNS
        FROM [Foreclosure])
        WHERE 
        (IIF( STRTOSET(@DimForeclosureLoanJudicialFlag, CONSTRAINED).Count = 1,
        STRTOSET(@DimForeclosureLoanJudicialFlag, CONSTRAINED),
        [Dim Foreclosure Loan].[Judicial Flag].currentmember)
        )CELL PROPERTIES VALUE

Update: Need help with the iif statment provided; see comments below.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:48:50+00:00Added an answer on June 4, 2026 at 3:48 pm

    I’m not 100% clear on what you’re asking but if I were to restate it, I think this is what you’re trying to do. I think you want to see Jud, Non-Jud, and Total on the columns. I think you’re trying to use the parameter to select a particular judicial flag. What’s not clear is whether the parameter values are limited to 1 and 2 as you show for the measures, or if there is a hierarchy there for which there are children for 1 and 2. I’m going to assume the first one because it’s easiest to explain and we can go from there.

    You need to set up your measures for the judicial flags 1 and 2 to consider what’s in the WHERE clause. Right now they are hard-coded and that tells SSAS to ignore whatever is in the WHERE clause. You need to use it conditionally by including an IIF statement in the Measure definition. You should return a NULL value as the False condition so that SSAS can execute the query optimally and then use the format_string property to fill in a zero in place of the NULL (which is better than using the 0 in the False condition for performance). However, your NON EMPTY keyword on columns will eliminate the judicial flag that’s not included in the WHERE clause so you need to remove that. Keep it on rows so that you display only the days that have values for either Jud or Non-Jud.

    Here’s an attempt at your query based on my guess of what you’re trying to do:

    WITH 
      MEMBER [Measures].[Jud] AS 
      iif(
            [Dim Foreclosure Loan].[Judicial Flag].CurrentMember is 
                [Dim Foreclosure Loan].[Judicial Flag].[1], 
                (
                  [Dim Foreclosure Loan].[Judicial Flag].[1]
                 ,[Dim Foreclosure Loan].[FCL Stage].&[Sale Held]
                 ,[Measures].[Loan Count]
                ),
                NULL), format_string="#;#;0;0"
      MEMBER [Measures].[Non-Jud] AS 
      iif(
            [Dim Foreclosure Loan].[Judicial Flag].CurrentMember is 
                [Dim Foreclosure Loan].[Judicial Flag].[0], 
                (
                  [Dim Foreclosure Loan].[Judicial Flag].[0]
                 ,[Dim Foreclosure Loan].[FCL Stage].&[Sale Held]
                 ,[Measures].[Loan Count]
                ),
                NULL), format_string="#;#;0;0" 
      MEMBER [Measures].[Total] AS 
        (
          [Dim Foreclosure Loan].[Judicial Flag]
         ,[Dim Foreclosure Loan].[FCL Stage].&[Sale Held]
         ,[Measures].[Loan Count]
        ) 
    SELECT 
      NON EMPTY 
        {
          [Dim Date].[Calendar].[Day].MEMBERS
        } ON ROWS
     , 
        {
          [Measures].[Jud]
         ,[Measures].[Non-Jud]
         ,[Measures].[Total]
        } ON COLUMNS
    FROM 
    (
      SELECT 
        StrToSet
        (@DimForeclosureLoanJudicialFlag
         ,CONSTRAINED
        ) ON COLUMNS
      FROM [Foreclosure]
    )
    WHERE 
      IIF
      (
          StrToSet
          (@DimForeclosureLoanJudicialFlag
           ,CONSTRAINED
          ).Count
        = 1
       ,StrToSet
        (@DimForeclosureLoanJudicialFlag
         ,CONSTRAINED
        )
       ,[Dim Foreclosure Loan].[Judicial Flag].CurrentMember
      )
    CELL PROPERTIES VALUE, FORMATTED_VALUE;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using JPA 2 with EclipseLink implementation. I'm trying to build a dynamic query which
I am trying to build a query which will do this: Lets say for
Greetings all, I have a question. I am trying to build a parametrized query
I am trying to build query in Play framework, I have select * from
Trying to build a linq query based on parameters a user selects (reporting) but
I'm trying to build a complex query with linq. I have a C# method
i am trying to build a query to compute Which org has the highest
I am trying to build correct query for my test server, and i am
I am trying to build a query that will select based on a DateTime
I am trying to find the best way to build a dynamic linq query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.