Forum Discussion

Sophie__'s avatar
Sophie__
Helper I
8 months ago
Solved

Model composite with seperate table

Hello,

I have a composite model with a FACT table in direct query and dimension tables in dual connection.

 

 


The direct query model works correctly when using dimension data with a calculation from the FACT table.

However, when I use a parameter table in a DAX that is not connected to the model, the filters on the direct query are no longer applied because I have a limit of 1 million rows which prevents the matrix from being displayed.

 

Solde =

VAR variation =

    SELECTEDVALUE ( Dim_variation[variation_key] )

VAR result =

    SWITCH (

        variation,

        "MTD", [Solde],

        "QTD",

            CALCULATE (

                [Solde],

                DATESINPERIOD ( 'Dim_Time'[date_key], MAX ( 'Dim_Time'[date_key]), -3, MONTH )

            ),

        "HTD",

            CALCULATE (

                [Solde],

                DATESINPERIOD ( 'Dim_Time'[date_key], MAX ( 'Dim_Time'[date_key] ), -6, MONTH )

            ),

        "YTD", CALCULATE ( [Solde], DATESYTD ('Dim_Time'[date_key] ))

    )

RETURN

    result

 

 

 

Why does the composite model remove the filters when using a SWITCH or IF statement in a DAX with a parameter table?

 

Thanks for your answer

Sophie

11 Replies

  • Hi Sophie__,

     

    I have similar models with disconnected tables and if expressions and did not get this type of issues, but me mindfull that each model as it own specifications.

     

    How are you setting up the matrix? What are the filters that impact the matrix and the calculations?

     

    Have you tried creating a Field parameter or a Calculation Group instead of an IF statement?

    • Sophie__'s avatar
      Sophie__
      Helper I

      Hi MFelix ,

      Power BI splits the query in two when I add a specific field; I don't understand why, and it's this query that returns over 1 million rows.

      Sophie

  • Hello MFelix ,


    the filters affecting the matrix are the date and an account.

     

    I have two dimensions in the matrix: a measure without a switch on the parameter table => no problem, but when I add a measure with the DAX on the parameter table => error message exceeding 1,000,000.


    Sophie