Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Model Relationship vs SWITCH vs Custom Matrix.

Hello All, 
This time I have following issue...

 

For the following funcions and following model funcion SWITCH works well

 

 

BUT for the following model and following funcions SWITCH doesn't work. 

 

I would like to understand what is the logic behind in one case (model without ralationship) I can assign sum of two values to Gross margin label but in other case (model with relationship) I can't? 
How to upragre my DAX to resolve this issue? 

Thank you in advance fo your reply. 
Thank 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Anonymous 

     

    It's easy to explain the behaviour if you know how filters interplay with CALCULATE, especially nested CALCULATE's.

     

    In the first example, the table 'Admin Categories' does not filter anything, even if you put its columns in a visual; hence you can see values. In the second example, 'Admin List' filters 'Admin Account'. Now, if you put a column from 'Admin List' in a visual, 'Admin Account' gets cross-filtered and the filter is "Gross Margin Level..." Hence, only rows which join to this value are visible in the current context. Since your measures [1] and [2] filter (in their definition) on the field 'Admin Account'[Level 1] and the values you want to filter by have been eliminated by the filter coming from 'Admin List'... well, therefore blank is returned.

4 Replies

  • Anonymous , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

    Also

    In the second case in Switch replace selectedvalue with Max and text once.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous 

         

        It's easy to explain the behaviour if you know how filters interplay with CALCULATE, especially nested CALCULATE's.

         

        In the first example, the table 'Admin Categories' does not filter anything, even if you put its columns in a visual; hence you can see values. In the second example, 'Admin List' filters 'Admin Account'. Now, if you put a column from 'Admin List' in a visual, 'Admin Account' gets cross-filtered and the filter is "Gross Margin Level..." Hence, only rows which join to this value are visible in the current context. Since your measures [1] and [2] filter (in their definition) on the field 'Admin Account'[Level 1] and the values you want to filter by have been eliminated by the filter coming from 'Admin List'... well, therefore blank is returned.