Forum Discussion
Show sub data from parent data from the same data source
- 1 year ago
Hi ja_02,
Thank you for your question. Based on the scenario you described, where you are working with a Tasks table containing both main tasks and sub-tasks, and you would like the second visual (sub-tasks) to dynamically respond to selections made in the first visual (main tasks), please find below our recommended approach:
In your model, main tasks use whole numbers (e.g., 1, 2) and sub-tasks use decimals (e.g., 1.1, 1.2), indicating a parent-child structure. Since this isn't explicitly defined, create a calculated column in the Tasks table (e.g., MainTaskID) to extract the parent ID for each sub-task.To avoid filtering conflicts between two visuals from the same table, create a disconnected table containing only main task IDs. Use this table in the main task visual.
Then, define a DAX measure that:
- Returns 1 when a sub-task's MainTaskID matches the selected main task
- Returns 1 when no selection is made (to show all sub-tasks)
- Returns 0 otherwise
Apply this measure as a visual-level filter in the sub-task table.
Your TaskAssignee mapping will still work, since we’re not changing relationships just controlling visuals with DAX.
This setup lets users click a main task and automatically see its related sub-tasks, or see all sub-tasks when nothing is selected achieving both clarity and flexibility.
If this solution worked for you, kindly mark it as Accept as Solution and feel free to give a Kudos, it would be much appreciated!
Kind regards,
Sahasra
Customer Support Team.
Hi ja_02 ,
You can totally build that kind of table in Power BI, even if Sales#1 and Sales#2 are in separate tables with no shared dimension.
Here’s a simple way to do it:
- Create a Date table and use it as the common axis for both tables.
- Use TREATAS in your measures to align both sales tables to the Date table:
Sales1 = CALCULATE(SUM(Sales1[Amount]), TREATAS(VALUES('Date'[Date]), Sales1[Date]))
Sales2 = CALCULATE(SUM(Sales2[Amount]), TREATAS(VALUES('Date'[Date]), Sales2[Date]))
Difference = [Sales1] - [Sales2]- Add these measures to a matrix visual with Month/Year from the Date table as rows.
For the total-only table, just use a card or table visual with:
Total = [Sales1] + [Sales2]
This setup works even without direct relationships between the tables.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI