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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
powerbi2srm
Resolver II
Resolver II

Compare two columns in different tables

Hi! I'm looking for the number of delivery notes with a delivery date (picking_date) greater than the invoice date. The DAX expressión should be similiar to:

 

 

Albaranes con fecha posterior a fecha facturación =
CALCULATE(
    COUNT(fact_stock_picking[stock_picking_id]),
    fact_stock_picking[picking_date_id]
    >
    fact_sale_invoice[invoice_date_id]
)

 

 

However that's wrong. I tried to use "RELATED" and "LOOKUPVALUE" but they doesn't work. I think that it's for the relationships between tables: fact_stock_picking and fact_sale_invoice are related by a bridge table (rel_stock_picking_sale_invoice).

Captura.PNG

 

The result that I'm looking for is like this SQL query:

sql.PNG

How can I do this in Power BI? Thank you!!

 

2 REPLIES 2
amitchandak
Super User
Super User

@powerbi2srm , try with help from common dim

Albaranes con fecha posterior a fecha facturación =
CALCULATE(
COUNTX(filter( Summarize(res_stock_picking_Sales_invoice, "_1" , min(fact_stock_picking[picking_date_id]), "_2", Min(fact_sale_invoice[invoice_date_id]))
[_1]> [_2]), [stock_picking_id]) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak I don't understand the expression

Captura.PNG

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors