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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
zazaalaza
Frequent Visitor

Unsolvable DAX conundrum in Matrix Visual?

Hi,

I have a matrix visual that is made from 2 unrelated tables and measures that executes against those 2 tables.

Test Measures: 

Positive = 
    IF ( 
        SELECTEDVALUE ( 'Columns'[Value] ) = SELECTEDVALUE ( 'Rows'[Value] ), 
        BLANK(), 
        RANDBETWEEN ( 10, 100 )
    )
Negative = 
    IF ( 
        SELECTEDVALUE ( 'Columns'[Value] ) = SELECTEDVALUE ( 'Rows'[Value] ), 
        BLANK(), 
        RANDBETWEEN ( 10, 100 ) * - 1 
    )


What I would like to do is to merge the 2 measures such that the positive values display above the diagonal line and the negative values are displayed below the negative values.

Screenshot 2024-01-04 at 16.46.28.png

I am having problems even approaching the issue, here is the powerbi file for reference: https://file.io/ZPVaVYkPmMrz

Would really appreciate if someone could point me in the right direction.

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Try this:

VAR _Row = SELECTEDVALUE ( 'Rows'[Value] )
VAR _Col = SELECTEDVALUE ( 'Columns'[Value] )
RETURN
    SWITCH (
        TRUE (),
        _Row < _Col, RANDBETWEEN ( 10, 100 ),
        _Row > _Col, RANDBETWEEN ( 10, 100 ) * -1
    )

 

AlexisOlson_0-1704385543020.png

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

Try this:

VAR _Row = SELECTEDVALUE ( 'Rows'[Value] )
VAR _Col = SELECTEDVALUE ( 'Columns'[Value] )
RETURN
    SWITCH (
        TRUE (),
        _Row < _Col, RANDBETWEEN ( 10, 100 ),
        _Row > _Col, RANDBETWEEN ( 10, 100 ) * -1
    )

 

AlexisOlson_0-1704385543020.png

The totals are reversed, Should also be negative and positive 🙂 But cool, this already works

That's because the row/column value is blank for those, which is treated like a zero when compared to 1-10.

 

I don't know what totals actually make sense in your scenario, so I didn't attempt to adjust them.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.