Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dieterbe_vdb
Frequent Visitor

Different behavior Table and Matrix

I have some issues with a Matrix visualisation.

 

Data (source) table:
dieterbe_vdb_0-1722366492303.png


I want to visualize, using a matrix, the amount of customers based on both Status and Prio. Moreover, I want to calculate the total percentage of customers per Prio vs the total number of customer for a specific Status using a measure called % Customers.

Measures used:

 

# Qty = COUNT(Data[Customer ])
Total All Prio = CALCULATE([# Qty], REMOVEFILTERS(Data[Prio]))
% Customers = DIVIDE([# Qty], [Total All Prio])
 
Everything works fine untill I add a slicer filtering out a couple of customers.

When I filter on customer A and D for example, the Table still shows the results that I expect:

  • Total All prio measure = 3 for Status Active and Prio Low as there are 3 rows in total from customers A and B who are in the Active State and the Prio filter is removed thanks to the measure used
  • The Matrix is showing me non expected figures => why does the measure Total All prio results in a value of 2 for Status Active and Prio Low? I expect the measure Total All Prio to be the same for Active High and Active Low samples (which is the case using the Table visualization) but apparently the Customer slicer does influence the filter context in a Matrix differently than it does for a Table

dieterbe_vdb_4-1722367940099.png

 

 

Any idea what is going on here?

I've attached the pibx file I'm using.

Many thanks for your help!

 

Table:

 

dieterbe_vdb_1-1722367034856.png

 

Matrix:

 

dieterbe_vdb_2-1722367047936.png

 

Problem Matrix Table.pbix

 

4 REPLIES 4
dieterbe_vdb
Frequent Visitor

Coming back to the example I've describe in my first post => I've created a Power BI report with two identical matrix visuals => one of them is behaving as I would expect, the other one isn't.

Link to Power BI report (incuding the DAX queries I'm referring to underneath):  Problem Matrix Table Bis.pbix

I examined the DAX queries used by both visuals and the strange thing that I notice, is that for one of the matrix visuals, a NONVISUAL function is added to the query. So alhough both matrices are identical, for an unexplainable reason, Power BI added the NONVISUAL function to one of the matrices.


The query as I expected him (working matrix):

************

DEFINE
    VAR __DS0FilterTable =
        TREATAS({"D",
            "A"}, 'Data'[Customer ])

    VAR __DS0Core =
        SUMMARIZECOLUMNS(
            ROLLUPADDISSUBTOTAL('Data'[Status], "IsGrandTotalRowTotal", 'Data'[Prio], "IsDM1Total"),
            __DS0FilterTable,
            "v__Qty", '_Measures'[# Qty],
            "Total_All_Prio", '_Measures'[Total All Prio]
        )

    VAR __DS0PrimaryWindowed =
        TOPN(502, __DS0Core, [IsGrandTotalRowTotal], 0, 'Data'[Status], 1, [IsDM1Total], 0, 'Data'[Prio], 1)

EVALUATE
    __DS0PrimaryWindowed

ORDER BY
    [IsGrandTotalRowTotal] DESC, 'Data'[Status], [IsDM1Total] DESC, 'Data'[Prio]



************

The query that creates bizarre results:
************

DEFINE
    VAR __DS0FilterTable =
        TREATAS({"D",
            "A"}, 'Data'[Customer ])

    VAR __DM3FilterTable =
        TREATAS({"Active",
            "Passive"}, 'Data'[Status])

    VAR __DS0Core =
        SUMMARIZECOLUMNS(
            ROLLUPADDISSUBTOTAL(
                'Data'[Status], "IsGrandTotalRowTotal",
               
                // Question: why is NONVISUAL appearing here?
                'Data'[Prio], "IsDM1Total", NONVISUAL(__DM3FilterTable)
            ),
            __DS0FilterTable,
            "v__Qty", '_Measures'[# Qty],
            "Total_All_Prio", '_Measures'[Total All Prio]
        )

    VAR __DS0PrimaryWindowed =
        TOPN(502, __DS0Core, [IsGrandTotalRowTotal], 0, 'Data'[Status], 1, [IsDM1Total], 0, 'Data'[Prio], 1)

EVALUATE
    __DS0PrimaryWindowed

ORDER BY
    [IsGrandTotalRowTotal] DESC, 'Data'[Status], [IsDM1Total] DESC, 'Data'[Prio]


************

So question remains: what causes the NONVISUAL function to be added?

Many thanks!!!

Anonymous
Not applicable

Hi @dieterbe_vdb ,

 

Thanks for the reply from @ThxAlot , please allow me to provide another insight: 

 

The hierarchical structure of the matrix is closely related to the context of the dax expression and, as a result, often causes some unexpected results. You can use dax expressions to create a dummy table and then perform calculations with the data in the dummy table to ensure the accuracy of the data.

MEASURE = 
VAR _SUMMARIZE =
    SUMMARIZE (
        ALLSELECTED ( 'Data' ),
        [Status],
        "Count", COUNT ( 'Data'[Customer ] )
    )
RETURN
    SUMX ( FILTER ( _SUMMARIZE, [Status] = MAX ( 'Data'[Status] ) ), [Count] )

vkaiyuemsft_0-1722587551771.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

dieterbe_vdb
Frequent Visitor

Thanks for trying out.

Bizarre.... any idea where the difference comes from?

It seems that in my pibx file the matrix "remembers" that Customer D didn't had any entry with a low prio in an active status and so when filtering out the Prio field the matrix only takes the entries of customer A in into account resulting in "2" (it should be "3") for the Total All Prio measure. Very strange indeed that your file, using the same measures, does behave as expected.

So this leaves me in a situation where I can't trust the Matrix visual any longer (unless if we can find a logical explanation for it).

ThxAlot
Super User
Super User

Hmm... indeed your file shows alien result whereas all goes as expected in my replica.

ThxAlot_0-1722373643426.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.