cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CrassJoin
Advocate I
Advocate I

SSAS Tabular - Default Detail Rows Expression

For a SSAS 2017 tabular model surfaced via pivot tables, a handy (vital) feature is the ability to drill through to a sensible selection of detail rows via double click on a measure (just like in the old school Excel pivot tables that your finance department can't part with). The content of the drillthough is determined by the table property [Default Detail Rows Expression]. The example Microsoft provides here is great insofar as it goes.

SELECTCOLUMNS(
    'Internet Sales',
    "Customer First Name", RELATED( Customer[Last Name]),
    "Customer Last Name", RELATED( Customer[First Name]),
    "Order Date", 'Internet Sales'[Order Date],
    "Internet Total Sales", [Internet Total Sales]
)

My problem is that I have a calendar table with an active relationship with my fact table (let's call this fact column end_date_sk) and an inactive relationship with the same table (let's call this fact column start_date_sk). If I want to return calendar columns from both the inactive and active relationships, what do I do? RELATED() only seems to work for the active relationship.

3 REPLIES 3
Anonymous
Not applicable

You have to change the relationship via a combination of CALCULATE and USERELATIONSHIP. But be careful where you do it. RELATED must work AFTER the relationship has been activated, not before.

Best
Darek

Thanks @Anonymous 

Can you link to an example of this? I tried USERELATIONSHIP with no joy.

Anonymous
Not applicable

Using RELATED(TABLE) is tricky with inactive relationships. Here's the code you're after.

 

New Table = 
SELECTCOLUMNS(
    'Fact',
    "Value For Column 1", RELATED( Dim[Value] ),
    "Value For Column 2",
        CALCULATE (
            CALCULATE (
                VALUES ( Dim[Value] ),
                'Fact'
            ),
            USERELATIONSHIP ( Dim[Column], 'Fact'[Column 2] ),
            ALL ( Dim )
        )
)

Assumptions:

  1. Fact is the fact table with 2 columns, Column 1 and Column 2. Both join on Column to Dim.
  2. Dim is a dimension table with Column and Value.
  3. The above retrieves the Value for Column 1 and Column 2 for each of of the rows in Fact.

If you want to know why so, please go to this article and read.

 

Best

Darek

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors