Forum Discussion

chienim's avatar
chienim
Frequent Visitor
9 years ago
Solved

Create relarionship between a DATE and a RANGE OF DATES?

Hello,   I just started PowerBI for a few days,   currently I have some problem merging 2 tables in terms of date,   the data sample looks like below: (1)Table A: Order fact which contains [Or...
  • ImkeF's avatar
    ImkeF
    9 years ago

    I would add another fact-table that allocates the sales to each campaign-day. That's a bit like a budget-table holding planned sales for multiple planning events (multiple campaigns) for the same dates and items. This allows for relative simple measures then:

     

    AvgCampSales = AVERAGE('CampaignSales'[CampaignSales])

    The table can be created like this:

     

    CampaignSales = GENERATE(Camapaign, FILTER(ALLNOBLANKROW(DimDate[Date]), DimDate[Date]>=EARLIER(Camapaign[CampaignStartDate]) && DimDate[Date]<=EARLIER(Camapaign[CampaignEndDate])))

    & you need an additional column to it:

     

    CampaignSales = 'Order'[AvgSalesAmt]

     

    You need to connect it like this:

     

    Have a look a the file:

    https://www.dropbox.com/s/sx28mk4c00ip740/PBI_CampaignManagement5.pbix?dl=0