Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
luisfgfurtado
Regular Visitor

SQL dynamic filter (relation by sql query)

I'm trying to use Power BI to make some reports for our Redmine. The Redmine uses MySQL database.
I already connected PowerBi direct to MySQL database and imported all tables that I need.
The problem is the way of Redmine relates projects and sub projects. All the projects are in the same table and two fields "lft" and "rgt" are used to determine the position of projects in a very large tree.
When I need to filter all children projects of a parent project, I use:

 

SELECT
*
FROM
(
SELECT * FROM `projects`
WHERE `identifier` like 'aprimora-ef'
) as mp
INNER JOIN `projects` p on p.`lft` BETWEEN mp.`lft` AND mp.`rgt`

Have some way to include this kind of filter in PowerBI?
I would like to display a list of some projecs and a table filtered by selected project including a total of issues of the selected

project and their subprojects.

 

 

thanks

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Not sure I fully understand your issue but will take a whack at it. You can relate tables to one another, so if you have a project table, you could import it twice (the second would be for relating to sub-projects), you could then have a slicer for project identifiers and it would slice a table that would display your sub-projects and issues.

 

Some example data and desired output might help clarify things.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Not sure I fully understand your issue but will take a whack at it. You can relate tables to one another, so if you have a project table, you could import it twice (the second would be for relating to sub-projects), you could then have a slicer for project identifiers and it would slice a table that would display your sub-projects and issues.

 

Some example data and desired output might help clarify things.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

How did you make the connection? Can you send an example please? Thanks.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors