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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
vbourbeau
Resolver II
Resolver II

Dax left join with dynamic filter on the second table

Hi,

look the image below... and the code here https://we.tl/t-QhP7KEPuaT 

Capture.PNG

So we have 2 tables 'parts' and 'transaction' which are left joined to create the table 'leftjoin'

All work great with the dax command NATURALLEFTOUTERJOIN.

 

But my final goal is to filter the transaction table by date. So if I want only transaction since 2020-04-01 my final table must have only the C part with 2 all the other one must be empty.

 

Thank for your help.

1 ACCEPTED SOLUTION

Hi, @vbourbeau 

 

You may modify the measure as below. The pbix file is attached in the end.

Total Measure = 
var tab = ALLSELECTED('transaction')
var result = 
SUMX(
    SUMMARIZE(
        Part,
        Part[Part],
        "Re",
        COUNTROWS(
            FILTER(
                tab,
                [Part2]=EARLIER(Part[Part])
            )
        )
    ),
    [Re]
)
return
COALESCE(result,0)

 

Result:

d1.png

 

Best Regards

Allan

 

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

View solution in original post

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @vbourbeau 

 

I'd like to suggest you modify the filter direction between 'Part' and 'transaction' as 'Both'. The pbix file is attached in the end.

d1.png

 

Then you may create a measure as below.

Total Measure = 
var tab = ALLSELECTED('transaction')
return
SUMX(
    SUMMARIZE(
        Part,
        Part[Part],
        "Re",
        COUNTROWS(
            FILTER(
                tab,
                [Part2]=EARLIER(Part[Part])
            )
        )
    ),
    [Re]
)

 

Result:

d2.png

d3.png

 

Best Regards

Allan

 

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

Thanks

 

But I need to see part without transaction. The goal it's to see the number of transaction for a period of time, even the part without transaction.

the result must be

A empty

B empty

C 2

D empty

...

Hi, @vbourbeau 

 

You may modify the measure as below. The pbix file is attached in the end.

Total Measure = 
var tab = ALLSELECTED('transaction')
var result = 
SUMX(
    SUMMARIZE(
        Part,
        Part[Part],
        "Re",
        COUNTROWS(
            FILTER(
                tab,
                [Part2]=EARLIER(Part[Part])
            )
        )
    ),
    [Re]
)
return
COALESCE(result,0)

 

Result:

d1.png

 

Best Regards

Allan

 

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

gpiero
Skilled Sharer
Skilled Sharer

@vbourbeau 

 

Hi, 
do you mean all visuals should display  only part C with total = 2 if date is >=01/04/2020 && <= TODAY()?

 

Regards

If I can...

 

No the final visual must display each part and the number. That alow us to see empty one.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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