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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MarkDGaal
Helper III
Helper III

Merge / Join Conditions and Clause >= or <=

 

I'm trying to duplicate this crossjoin I have in Tableau:

 

Note the Join Clauses of RFP/RFI Release Date >= Date (list of all possible date times starting from the begining of 2015)

and 

Proposal Submissiond Date < = Date

 

what is the best way to go about creating this condidtional join type using Merge Queries in PowerBI?

 

Thus far I've played around once bringing the entire Dates table over using condidtional columns and filtering, but not sure if that's working correctly.

1 ACCEPTED SOLUTION

@MarkDGaal

 

It looks that you're looking for a LEFT JOIN, if so, instead of using merger queries, I'd prefer DAX. Check if below sample helps.

 

Capture.PNG

 

Table =
NATURALLEFTOUTERJOIN (
    opportunities,
    FILTER (
        CROSSJOIN ( opportunities, dates ),
        opportunities[RFP/RFI Release Date ] >= dates[dates]
            && opportunities[Proposal Submissiond Date ] <= dates[dates]
    )
)

View solution in original post

8 REPLIES 8
MarkDGaal
Helper III
Helper III

Thus far I've tried:

let
    Source = #"SRC_crm_pipeline opportunities",
    #"Merged Queries" = Table.NestedJoin(Source,{"RFP/RFI_Release_Date"},#"SRC_crm_pipeline dates",{"Date"},"NewColumn",JoinKind.LeftOuter),
    #"Expanded NewColumn" = Table.ExpandTableColumn(#"Merged Queries", "NewColumn", {"Date", "Day_of_Week", "Day", "Month", "Year", "Holiday", "Workday"}, {"Date", "Day_of_Week", "Day", "Month", "Year", "Holiday", "Workday"}),
    #"Added Custom" = Table.AddColumn(#"Expanded NewColumn", "RFP/RFI >= and Proposal_Submission <=", each if(([#"RFP/RFI_Release_Date"]>=[Date] or null)) then "Yes"
else if(([#"Proposal_Submission_Date_©"]<=[Date] or null)) then "Yes"
else "No"),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([#"RFP/RFI >= and Proposal_Submission <="] = "Yes")),
    #"Changed Type" = Table.TransformColumnTypes(#"Filtered Rows",{{"RFP/RFI >= and Proposal_Submission <=", type text}})
in
    #"Changed Type"

but I believe this is different than the crossjoin as my final tables have vastly differing amounts of records 

@MarkDGaal

 

It looks that you're looking for a LEFT JOIN, if so, instead of using merger queries, I'd prefer DAX. Check if below sample helps.

 

Capture.PNG

 

Table =
NATURALLEFTOUTERJOIN (
    opportunities,
    FILTER (
        CROSSJOIN ( opportunities, dates ),
        opportunities[RFP/RFI Release Date ] >= dates[dates]
            && opportunities[Proposal Submissiond Date ] <= dates[dates]
    )
)

Hi,

 

Could you please suggest me how to achive it using power query instead of dax?

 

Thanks,

Amit

@Eric_Zhang Oh...... now I get it.... you wanted me to create a calculated table in the data view. Haven't ever done that before. It works (number of records match the Tableau join), thank you@

 

Out of curiosity is there a Power Query / M Script Solution to this problem?

hummmm, are you suggesting that I simply create a new column inside the opportunities table?

If so I get the following error with that formula:

Untitled.png

@MarkDGaal

 

Can you post some sample data in your case? Even better you can upload a pbix.

@Eric_Zhang

sampledata as requested

Pbix

data

@Eric_Zhang Will do, sanatizing now; as a note I did find this similar thread/question on crossjoins with conditions using m-script/power query: Link answered by @ImkeF however they later got into some stuff that I don't quite understand about delimiting with a "|" and don't think I need for my situation.

 

I'll post an example file with an hour or so. 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.