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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
molden
Frequent Visitor

Check Orders Within A Given Date

Hi All,

 

I'm new to Power BI. For my 1st project I am trying to determine if an order came from a marketing campaign.

 

I have a list of campaigns, the customers involved and the start and end date they ran from.

 

What I am trying to figure out is for every order is the customer in a campaign and have ordered between the start and end date the campaign ran for.

 

Hope this makes sense. 

 

I have set up 3 spread sheets:

 

Campaign Audience

Campaign ID

Customer ID

 

Campaigns

Campaign ID

Campaign Name

Start Date

End Date

 

Orders

Customer ID

Order Date

Product

 

Thanks in advance.

Michael

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@molden

You can either create a measure as below

1.You can try to create a measure as below. Then you may get the respected result.
Measure =
MAXX (
    FILTER (
        campaigns,
        MAX ( orders[order date] ) >= campaigns[start date]
            && MAX ( orders[order date] ) <= campaigns[end date]
    ),
    campaigns[campaign id ]
) 

Capture.PNG

 

Or create an auxiliary table to extend the campaign row(start date and end date) to rows of each day. And then create a one to one relationship between the created table and order table.

Table =
FILTER (
    CROSSJOIN ( 'calendar date', campaigns ),
    'calendar date'[Date] >= campaigns[start date]
        && 'calendar date'[Date] <= campaigns[end date]
)

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee

@molden

You can either create a measure as below

1.You can try to create a measure as below. Then you may get the respected result.
Measure =
MAXX (
    FILTER (
        campaigns,
        MAX ( orders[order date] ) >= campaigns[start date]
            && MAX ( orders[order date] ) <= campaigns[end date]
    ),
    campaigns[campaign id ]
) 

Capture.PNG

 

Or create an auxiliary table to extend the campaign row(start date and end date) to rows of each day. And then create a one to one relationship between the created table and order table.

Table =
FILTER (
    CROSSJOIN ( 'calendar date', campaigns ),
    'calendar date'[Date] >= campaigns[start date]
        && 'calendar date'[Date] <= campaigns[end date]
)

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.