Forum Discussion
Mr_Glister
2 years agoAdvocate II
Only show subset/sample of data with Direct Query
Hi, I have a table with many millions of Image URLs in it, and connect to it through Direct Query. We can assume the columns in the table are COUNTRY / STATE / WAREHOUSE / DATE / VALUE / IMAGE URL...
- 2 years ago
I realized instead of doing something complicated in PowerBI it makes much more sense to do something slightly more complicated directly in the SQL statement.
For anybody else with the same problem, here is what was the perfect solution for me:
select * from prod.sales where invoice_date > current_timestamp - interval '30 days' qualify row_number() over(partition by country, state, warehouse, date order by value DESC) <=10
Mr_Glister
2 years agoAdvocate II
I realized instead of doing something complicated in PowerBI it makes much more sense to do something slightly more complicated directly in the SQL statement.
For anybody else with the same problem, here is what was the perfect solution for me:
select * from prod.sales
where
invoice_date > current_timestamp - interval '30 days'
qualify
row_number() over(partition by country, state, warehouse, date order by value DESC) <=10