Search code examples
mdx

Mondrian find dimension from facts


I need to find the actual column values of my dimensions for which facts are present. Is there a syntax in Mondrain to find the same. Currently I am running the below sql inner join query to find the dimension data

    select 
            distinct the_month as Month,
            the_year as Year,
            quarter as Quarter,
            storename as name
            storedimension,
            perioddimension,
            storevisitfact where
            storevisitfact.time_id=perioddimension.time_id
            and storevisitfact.storedimension_id=storedimensionstoredimension_id

Solution

  • Non Empty will do your work:

    select 
    non empty {[Date].[Calendar].[Year].Members, [Date].[Calendar].[Quarter].Members, [Date].[Calendar].[Month].Members} * [Store].[Store].[Store].Members * [Measures].[Visits] on 0
    from
    [YourCube]