Forum Discussion
Only show subset/sample of data with Direct Query
- 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 , Create a rownumber measure based on the columns used in visual and then use that as a visual level filter
example
New Row Number = ROWNUMBER(ALLSELECTED(Sales[Order No]),ORDERBY([Net],DESC))
or
New Row Number = ROWNUMBER(ALLSELECTED(Sales[Order No], sales[Item id]),ORDERBY([Net],DESC))
Power BI - New DAX Function: Rownumber- https://www.youtube.com/watch?v=yS9-IQjUDwg&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1
- Mr_Glister2 years agoAdvocate II
Hi amitchandak,
I tried your approach and also watched your video but I'm running into the same problem as when I use TOP N in the visual filter.