Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Setting up data model

Hi All!  My team is moving some of our legacy SSRS reports to Power BI and I've run into a snag with how to set up the data model for one particular report and was hoping for some help.   We have a...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Thanks Greg.  I'm new to Power BI, but super excited by the possibilities.  I'll add more context to the below.

     

    Essentially what we're doing is unioning our 'actuals' table and our future 'forecasted' table.  Depending on the dates selected, data could come from both tables or just 1.   

     

    I created some dummy data that represents the 2 tables we're pulling from.  

     

    forecasted table  
    transaction_IDtransaction_dateas_of_dateRevenue
    13/21/20193/18/201975
    23/23/20193/18/2019125
    33/28/20193/18/2019175
    13/21/20193/19/2019225
    23/23/20193/19/2019275
    33/28/20193/19/2019325
    43/29/20193/19/2019375

     

    actuals table  
    transaction_IDtransaction_dateRevenue
    10013/1/2019100
    10023/3/2019125
    10033/3/2019150
    10043/15/2019200
    10053/14/2019250
    10063/17/2019

    300

     

    In the original example I provided, the user enters a 'start_date' = 3/1/2019, 'end_date' = 3/31/2019, and an 'as_of_date' = 3/19/2019.  I highlighted in Red the records that would be selected for this scenario.  This would give me a Revenue of $2325.

     

    In this example, we're wanting data from the 'forecasted' table from the 'as_of_date' = 3/19/2019 to the 'end_date' = 3/31/2019, and data from the 'actuals' table from the 'start_date' = 3/1/2019 to the ('as_of_date' - 1) = 3/18/2019.

     

    This is kind of challenging for me to explain in plain english, so if I can provide more clarity, please let me know.  Thanks in advance for the help!

     

    **EDIT**  Was able to come up with a solution using DAX to make a few intermediate calculations that I think got me what I needed.  Closing the thread