Forum Discussion
Parameter for a dinamic table?
- 1 year ago
Hi greta ,
To achieve a dynamic table in Power BI that aggregates categories into a "tot" group when they are not shared across multiple cost types, parameters alone won't work because they are static and don't respond to filter context. Instead, you'll need to use DAX to create a calculated table that evaluates which categories appear in more than one cost type and preserves them, while aggregating all others under a new "tot" category.
This approach ensures your output adapts dynamically to slicers or filters such as project selection, and correctly groups and summarizes your data for reporting purposes.
Here’s a DAX example for the calculated table:
DynamicTable = VAR SharedCategories = CALCULATETABLE ( VALUES ( 'YourTable'[Categories] ), FILTER ( 'YourTable', CALCULATE ( DISTINCTCOUNT ( 'YourTable'[Cost Type] ) ) > 1 ) ) RETURN SUMMARIZE ( ADDCOLUMNS ( 'YourTable', "NewCategory", IF ( 'YourTable'[Categories] IN SharedCategories, 'YourTable'[Categories], "tot" ) ), 'YourTable'[Cost Type], [NewCategory], "Value", SUM ( 'YourTable'[Value] ) )
Hi greta -please find the attached pbix file that i have implement a solution that works dynamically with filters like project selection.