Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi ,
I am new to Power Bi and I am trying some reporting stuffs with Power BI.
I am trying to query some data from a DB2 database which I have connected via the ODBC connections. My requirement here is to fetch data for the current date.
Take a look at a simple SQL query :
select * from tablename where date = dt.
here date is the variable from my table and dt should be the current date that I want.
Any guidance.
Solved! Go to Solution.
Try using CURRENT DATE instead. Specifying CURRENT_DATE is equivalent to specifying CURRENT DATE.
SELECT * FROM tablename WHERE date = CURRENT DATE
Reference: https://stackoverflow.com/questions/32478642/how-to-select-data-from-db2-for-current-date
In addition, Current date is in yyyy-mm-dd format. If your date column is in other format, you may need to convert its format. Please refer to https://stackoverflow.com/questions/10320918/db2-date-format
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @VivekKakkoth ,
In Power Query M, you would bring in all the data, then filter as follows:
Table.SelectRows(
previousStepName,
each [date] = #date(2022, 05, 01)
// OR: each [date] = variableName to use a defined variable
// OR: each [date] = Date.From(DateTime.LocalNow()) to use today's/current date
)
Pete
Proud to be a Datanaut!
try this
SELECT * FROM table where DATE(date)=CURDATE()
DATE(date)=CURDATE()
These formats are not working.. I had tried this option before I posted this requirement. It is throwing an SQL error as :
Try using CURRENT DATE instead. Specifying CURRENT_DATE is equivalent to specifying CURRENT DATE.
SELECT * FROM tablename WHERE date = CURRENT DATE
Reference: https://stackoverflow.com/questions/32478642/how-to-select-data-from-db2-for-current-date
In addition, Current date is in yyyy-mm-dd format. If your date column is in other format, you may need to convert its format. Please refer to https://stackoverflow.com/questions/10320918/db2-date-format
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
This Worked !!! 😃
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 7 | |
| 6 |