Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Is it possible to create an Oracle SQL query in parameters that would be "last 12 months"?
I'm pulling in multiple tables with an Oracle query that would look like:
let
query = "SELECT * FROM TABLE WHERE DATE_COLUMN >= TO_DATE('" & RangeStart & "', 'DD/MM/YY')",
Source = Oracle.Database("abcd.com", [HierarchicalNavigation=true, Query=query])
in
Source
I created the parameter that currently has "1/4/22" for April 1, 2022.
Is it possible to create a parameter that dynamically changes to "last 12 months"?
I know, I could just have my SQL query be something like this:
WHERE
DATE_COLUMN BETWEEN TRUNC(ADD_MONTHS(SYSDATE,
-12),
'MONTH')
AND TRUNC(SYSDATE,
'MONTH') -1
but I have multiple tables and I don't want to have to go into each query and manually update the date range.
Do you need to use hand-authored queries? Why not just connect to your source and use the power query experience to filter your data with the date filter options (that include a relative option). It should "fold" back to your source with similar queries.
Pat
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
147 | |
109 | |
107 | |
85 | |
63 |