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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
luizzed
Frequent Visitor

Conditional with DAX using columns from different tables

Hi!
I have two tables:

dimension

luizzed_0-1625258977653.png

fact

luizzed_1-1625259004801.png

with this relationship

luizzed_2-1625259033844.png

I'm trying to make a measure that when the value of the dimension[Value] column is empty, use the value of the fact[Subvalue] column. I could do this with Power Query or calculated column, but I'm trying with dax, I did this dax meause here, but when the dimension[Value] column value is empty, it returns empty instead of Germany.

 
Conditional Column =
var principal = CALCULATE(LASTNONBLANK('dimension'[Value],TRUE()),CROSSFILTER('dimension'[Index],fact[Index],Both))
var secondary = FIRSTNONBLANK('fact'[Subvalue],true())
RETURN
COALESCE(principal,secondary)

 

luizzed_3-1625259365724.png

how do i get this with DAX measure?

 

1 ACCEPTED SOLUTION
smpa01
Community Champion
Community Champion

Measure = 
IF (
    MAX ( dim[Value] ) = BLANK (),
    CALCULATE (
        MAXX ( FILTER ( 'fact', 'fact'[Index] = MAX ( dim[Index] ) ), 'fact'[Value] )
    ),
    MAX ( dim[Value] )
)

@luizzed 

 

Capture.PNG

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hello that such community, I have a similar request, I want to place a UNIQUE value in a "CARD" try with the code that comes in the previous example but did not come out excato what I need.

My problem is as follows:

PBI.png

Thank you in advance for your valuable contributions

smpa01
Community Champion
Community Champion

Measure = 
IF (
    MAX ( dim[Value] ) = BLANK (),
    CALCULATE (
        MAXX ( FILTER ( 'fact', 'fact'[Index] = MAX ( dim[Index] ) ), 'fact'[Value] )
    ),
    MAX ( dim[Value] )
)

@luizzed 

 

Capture.PNG

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.