Forum Discussion

Seiryth's avatar
Seiryth
Frequent Visitor
9 years ago
Solved

dynamic dates with a direct query

Hi All,    Just a few questions. I'm relatively new to powerbi so bare with me :)    1) I've got two tables from a mssql database that im direct querying against - sales and product. both have an...
  • GilbertQ's avatar
    GilbertQ
    9 years ago

    I would suggest that you either bring in your date table, or create a date table in your Power BI Model. In doing so if both tables are related to the date table, you can then filter using the date, which will then filter both data sets.

     

    Along with this, in your date table you could create a calculated column or even in your underlying date table source, in this column you can create the logic which will tell you which month is the current month. So for example in your date table, when the dates are for October 2016, your calculated column will return a value of "This Month", and for all other dates it will return "Other Months"

     

    Then in your Power BI Model, you can add the filter to either the visual level filter, page level filter or report level filter and select "This Month" from your calculated column. In doing so everytime you refresh your data it will then update and reflect the current month.