cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
benisanders Regular Visitor
Regular Visitor

Re: Cartesian Join of two queries to create new table with a record for each CustomerID, for each mo

@MarcelBeug i realize this is an old post, and there may be a better way to do this at this point, but is there a way to filter the join criteria based on two other fields in the table?  So for the below code, in the "#"Added Custom" I would only want the distinct DateMonths wich are larger than a start date and smaller than an end date in the OpportunityLineItem table.

let
Source = Salesforce.Data(),
OpportunityLineItem = Source{[Name="OpportunityLineItem"]}[Data],
#"Filtered Rows1" = Table.SelectRows(OpportunityLineItem, each [Start_Date__c] >= #date(2016, 1, 1)),
#"Added Custom" = Table.AddColumn(#"Filtered Rows1", "DateMonth", each DistinctMonths[DateMonth])
in
#"Added Custom"

 

I tried this 

Table.AddColumn(#"Filtered Rows1", "DateMonth", each DistinctMonths[DateMonth] >= Date.StartOfMonth([Start_Date__c]) DistinctMonths[DateMonth] < Date.StartOfMonth([End_Date__c]))

and i get the follwoing error:  

Expression.Error: We cannot apply operator >= to types List and Date.
Details:
    Operator=>=
    Left=List
    Right=10/1/2017

 

(the reference table DistinctMonths has a single Date formated column with months in a given date range set as the first of each month)

Highlighted
benisanders Regular Visitor
Regular Visitor

Re: Cartesian Join of two queries to create new table with a record for each CustomerID, for each mo

@MarcelBeug i realize this is an old post, and there may be a better way to do this at this point, but is there a way to filter the join criteria based on two other fields in the table?  So for the below code, in the "#"Added Custom" I would only want the distinct DateMonths wich are larger than a start date and smaller than an end date in the OpportunityLineItem table.

let
Source = Salesforce.Data(),
OpportunityLineItem = Source{[Name="OpportunityLineItem"]}[Data],
#"Filtered Rows1" = Table.SelectRows(OpportunityLineItem, each [Start_Date__c] >= #date(2016, 1, 1)),
#"Added Custom" = Table.AddColumn(#"Filtered Rows1", "DateMonth", each DistinctMonths[DateMonth])
in
#"Added Custom"

 

I tried this 

Table.AddColumn(#"Filtered Rows1", "DateMonth", each DistinctMonths[DateMonth] >= Date.StartOfMonth([Start_Date__c]) DistinctMonths[DateMonth] < Date.StartOfMonth([End_Date__c]))

and i get the follwoing error:  

Expression.Error: We cannot apply operator >= to types List and Date.
Details:
    Operator=>=
    Left=List
    Right=10/1/2017

 

(the reference table DistinctMonths has a single Date formated column with months in a given date range set as the first of each month)

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 106 members 1,349 guests
Please welcome our newest community members: